CrazyEngineers
  • How to execute an applet program written in java

    Updated: Oct 22, 2024
    Views: 1.5K
    Hi friends. Can any one tell me how to execute an applet program.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Kaustubh Katdare

    AdministratorFeb 5, 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?
    Are you sure? This action cannot be undone.
    Cancel
  • shalini_goel14

    MemberFeb 5, 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. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • rama_krish627

    MemberFeb 6, 2009

    Re: How to exicute an applet program written in java

    ya it's working. but the last one is not working.
    Are you sure? This action cannot be undone.
    Cancel
  • shalini_goel14

    MemberFeb 6, 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. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • sookie

    MemberAug 21, 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
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register