rama_krish627
rama_krish627
Branch Unspecified
05 Feb 2009

How to execute an applet program written in java

Hi friends. Can any one tell me how to execute an applet program.
05 Feb 2009
Re: How to exicute an applet program written in java

rama_krish627
Hi friends. Can any one tell me how to execute an applet program.
You'll have to embed it in HTML. Do you know how to do that?
shalini_goel14

shalini_goel14

Branch Unspecified
05 Feb 2009
Re: How to exicute an applet program written in java

rama_krish627
Hi friends. Can any one tell me how to execute an applet program.
Hi rama_krisha

Applets can be executed in 2 ways:

1. Executing the applet within a java-compatible web browser.
For this write html code that has APPLET tag.
   <applet code="[your java file name]" width=200 height=200>
   </applet>
   
Now simply run this file as a normal html file.

2. Using an applet viewer. Applet viewer executes your applet in a window. This is fastest and easiest way to test your applet.
In this make a separate file AppletHtml.html of same code as above.
  <applet code="[your java file name]" width=200 height=200>
  </applet>
  
Then run above file as following command:
C:\>appletviewer AppletHtml.html


3. Better is one more way which is more commonly use - Simply include a comment at the head of you Java file/program
/* 
<applet code="[your java file name]" width=200 height=200>
   </applet>
*/
   
Then execute the appletviewer as told in point no2.

Hope I am correct and can be helpful .Others can correct me. 😀
rama_krish627

rama_krish627

Branch Unspecified
07 Feb 2009
Re: How to exicute an applet program written in java

ya it's working. but the last one is not working.
shalini_goel14

shalini_goel14

Branch Unspecified
07 Feb 2009
Re: How to exicute an applet program written in java

rama_krish627
ya it's working. but the last one is not working.
Hi rama_krish,

What is not working? What steps you followed to do so. Better share your program here if you have no issues with it. 😀
sookie

sookie

Branch Unspecified
21 Aug 2009
Re: How to exicute an applet program written in java

Hi rama_krish627,

To make the last case working, you need to follow following three steps

Step # 1: Edit your Java source file.Add following lines of code in your java class file
/*
<applet code="[your java file name]" width=200 height=200>
   </applet>
*/
Step # 2: Compile your program
Step # 3: Execute the appletviewer , specifying the name of your applet's source file. For eg., if your applet's source file(or your java program only) is in folder I:\JavaSrcCode then open command prompt ->switch to the location of your java(or applet ) source file-> type following command at it
I:\JavaSrcCode>appletviewer MyFirstApplet.java

Share this content on your social channels -

Only logged in users can reply.