|
|
View Java applet source
View Mona.gif (can download from here)
How to create a Jar file
- Compile your .java files to create the .class files:
C:\Temp> javac SmileJar.java
- Create the Jar file, with all .class and graphic and sound files:
C:\Temp> jar -cvf Smile.jar SmileJar.class Mona.gif
- Create an HTML file to display your Applet in a Jar.
(Note the new
ARCHIVE attribute.)
<APPLET CODE="SmileJar" WIDTH="320" HEIGHT="410" ARCHIVE="Smile.jar">
<PARAM NAME="IMAGE" VALUE="Mona.gif">
<STRONG> Sorry, you have a Java-challenged browser! </STRONG>
</APPLET>
- You should also test out your Jar Applet, by moving the
.jar
and .htm files to another directory (or by moving or deleting
the original .class and media files).
|