Results 1 to 4 of 4

Thread: How to run java applet program using cmd

  1. #1
    Join Date
    Dec 2011
    Posts
    40

    How to run java applet program using cmd

    Hi friends, recently I have started learning the Java Applet, I have completed chapter first. There are some of the few steps were given to execute the Applet using the command prompt, however I am not able to understand the concept that were written on that notes. SO I just want to know how I can execute the java Applet program using cmd. I have try various steps to make it happen but still not able to clear with the steps for running the Java Applet using cmd. So if you guys have any of the information or any of the solution or ideas then please let me know.

  2. #2
    Join Date
    Mar 2011
    Posts
    160

    Re: How to run java applet program using cmd

    According to my information you have to first compile your source code that you have created, so for that you just have to make use of the cmd and then go to the proper directory where you have save your source code. And then compile the source code with the command
    javac yourcode.java // yourcode is the name of the java class that you have created.
    After compiling your source code, you have to make use of the appletviewer to view your applet page.
    appletviewer yourcode.java // yourcode is the name of the java class that you have created.

  3. #3
    Join Date
    May 2011
    Posts
    105

    Re: How to run java applet program using cmd

    To run any of the Applet program, you have to follow this simple steps:
    • The first thing you have to do is to save the applet file and the html file in the same folder.
    • Then you have to compile the applet program using command prompt ‘javac ClassName.java’.
    • And finally type ‘appletviewer YourClassName.html’
    • Your applets program executes.

  4. #4
    Join Date
    May 2011
    Posts
    97

    Re: How to run java applet program using cmd

    Try this simple Applet program, may it will help you out
    First create a simple Applet code and save it as Abc.java
    import java.applet.*;
    import java.awt.*;
    public class Abc extends Applet
    {
    String str;
    public void init()
    {
    str = "Hi Dude!!! This works…";
    }
    public void paint(Graphics g)
    {
    g.drawString(str, 50,50);
    }
    }
    And then create one html page and save it as abc.html:

    <HTML>
    <BODY>
    <applet code="Abc",height="400" width="400">
    </applet>
    </BODY>
    </HTML>
    Make sure to place this both file in the same folder.
    Open cmd and compile the Applet code using javac.
    • javac Abc.java


    And then make use of appletviewer to execute your applet program
    • appletviewer abc.html

Similar Threads

  1. Zoom in on a Java Applet?
    By Bharata in forum Software Development
    Replies: 6
    Last Post: 21-10-2010, 07:01 AM
  2. Java applet errors
    By Harpreet Gaur in forum Software Development
    Replies: 5
    Last Post: 12-01-2010, 12:08 PM
  3. How to run an Applet Program
    By sarafsneh in forum Software Development
    Replies: 1
    Last Post: 04-01-2010, 06:07 PM
  4. Display java applet - chess
    By Gunner 1 in forum Software Development
    Replies: 5
    Last Post: 04-01-2010, 11:27 AM
  5. Refresh Java Applet
    By Brake Fail in forum Software Development
    Replies: 6
    Last Post: 16-03-2009, 10:02 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,428,097.38725 seconds with 17 queries