Workshop 2007 JRE Java Support
Installation
Home
CalcTool
Java Applets
Friends/Family
Gardening
Woodworking
Forums

You will no doubt want to package and deploy your applet so that others can use it. You will need two things for this— a .jar file and a .htm (or .html) file.  The .htm file is something you must create.

 

Find .jar file. 

The .jar file is an archive that contains all necessary code to run the applet.  NetBeans has automatically created it for you. Navigate to the HelloWorldProject on your hard drive.  It will contain the folder dist. Inside this you will find HelloWorldProject.jar.  Copy (or move) this file to the folder that will contain your .htm file.

 

Create helloWorld.html. 

I recommend using my helloWorld.html file as a template. Right-click to download this file here and place is same folder as your .jar file.  Open with Notepad, WordPad, Word, etc. to change the settings to suit your project. If you’ve used all of the naming conventions that I’ve suggested, you should not have to change anything.  But if you do, the key line to alter follows.

<applet code="edu.usafa.helloworld.HelloWorldApplet" archive="HelloWorldProject.jar" width="400" height="300"></applet>

 

Let’s look at each piece of this line

 

If any of these are not correct, the applet may not run in your browser.

 

Click on helloWorld.html to run applet in browser.

Deploying an Applet