This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to run the applet from command line?

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does someone can give to me an advice how to run the Java applet from command line?
Thnaks
 
Greenhorn
Posts: 18
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Running Applet in Command Line is simple.
First, Embed the following code in the applet file as a multiline comment.
Ex: your applet class file name is SampleApplet.class
/*
<applet code="SampleApplet.class" CodeBase="" width=300 height=400></applet>
*/
in the Command Line,
c:>appletviewer SampleApplet.java
 
Mike Shn
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where do I have to put the
/*
<applet code="SampleApplet.class" CodeBase="" width=300 height=400></applet>
*/
In the HTML document?
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where do I have to put the
/*
<applet code="SampleApplet.class" CodeBase="" width=300 height=400></applet>
*/
In the HTML document?

hello there,
/*
<html>
<applet code="SampleApplet.class" CodeBase="" width=300 height=400></applet>
</html>
*/
save this as "SampleApplet.html"
c:\>javac SampleApplet.java
c:\>appletviewer SampleApplet.html

martha
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi mike,
Let me answer you in a very simple so that you can understand. First write a applet. Save it in .java. And then compile it from the command line with javac applet.java and then execute it with this command appletviewer applet.java. But i hope you are doing all this after seeting the class path. After setting the path you can use this. Suppose you have saved your file in c:/applets folder. Go to that folder in dos prompt like this
c:/applet> javac applet.java
enter and then
c:/applet> appletviewer applet.java
enter
I hope this helps you and type inside your java code either on top or on bottom.
/*<applet code=applet.java width=100 height=100>
</applet>*/
This recognizes the code as applet
abhinav
 
straws are for suckers. tiny ads are for attractive people.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic