•Before executing applets, we must compile the program in the same way as you compile a console application. Let the name of my file be “MyApplet.java”. So, for compiling we use:
javac MyApplet.java
•Now, execution of applets is different from executing console applications as applets do not have a main() method. Applets can be executed in two ways:
1) By using any standard web browser( like IE, firefox, chrome)
2) By using “applet viewer” tool provided by Java SDK.
Executing Applets (Using Browser):
Executing Applets (Using applet viewer):
•By now, you have created two files: MyApplet.java and MyApplet.html.
•applet viewer is a command line tool provided by Java SDK to test the applets before deploying them to web pages.
•For executing applets using applet viewer, open command prompt, navigate to the location where your files are present and type the following:
appletviewer MyApplet.html
(or)
If you don't want to create a html page separately, you can embed the <applet> tag within in the source program file, which is in my example: MyApplet.java
You can now execute your applet program by using the following command at command prompt:
appletviewer MyApplet.java
javac MyApplet.java
•Now, execution of applets is different from executing console applications as applets do not have a main() method. Applets can be executed in two ways:
1) By using any standard web browser( like IE, firefox, chrome)
2) By using “applet viewer” tool provided by Java SDK.
Executing Applets (Using Browser):
Executing Applets (Using applet viewer):
•By now, you have created two files: MyApplet.java and MyApplet.html.
•applet viewer is a command line tool provided by Java SDK to test the applets before deploying them to web pages.
•For executing applets using applet viewer, open command prompt, navigate to the location where your files are present and type the following:
appletviewer MyApplet.html
(or)
If you don't want to create a html page separately, you can embed the <applet> tag within in the source program file, which is in my example: MyApplet.java
You can now execute your applet program by using the following command at command prompt:
appletviewer MyApplet.java
Nice and helpful post. Thanks a lot for posting informative article on executing applets . The best thing is you explained everything with the help of examples. Thank you so much!
ReplyDeletedigital signature software