Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to run java applet program using cmd

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 07-01-2012
Member
 
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.

Reply With Quote
  #2  
Old 07-01-2012
Member
 
Join Date: Mar 2011
Posts: 156
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.
Reply With Quote
  #3  
Old 07-01-2012
Member
 
Join Date: May 2011
Posts: 103
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.
Reply With Quote
  #4  
Old 07-01-2012
Member
 
Join Date: May 2011
Posts: 95
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
Quote:
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:

Quote:
<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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to run java applet program using cmd"
Thread Thread Starter Forum Replies Last Post
Zoom in on a Java Applet? Bharata Software Development 6 21-10-2010 07:01 AM
Java applet errors Harpreet Gaur Software Development 5 12-01-2010 12:08 PM
How to run an Applet Program sarafsneh Software Development 1 04-01-2010 06:07 PM
Display java applet - chess Gunner 1 Software Development 5 04-01-2010 11:27 AM
Refresh Java Applet Brake Fail Software Development 6 16-03-2009 10:02 PM


All times are GMT +5.5. The time now is 07:08 PM.