Duke CS Logo CompSci 6: Program Design & Analysis I
(Fall 2009)
Home
Course Information
Calendar
Assignments
APT problems
Resources
Old Tests
More Old Tests
Installing Eclipse
Ambient
Java API
Posting applets
Help sessions
Discussion Forum
Blackboard
Oasis

To post your program on the web so that others can see it within a web page, you must package it properly and create a web page that includes the proper HTML tag to inform the browser how to run your program. These steps are described in detail below.

Packaging your Project

To package all of the code that makes up your game into a single file, your will need to save your project as a Java ARchive, JAR, file.

  1. From Eclipse, export your project (select File->Export->JAR file).
  2. After clicking Next and selecting the project to export, and selecting the project to export, put checks by the boxes for
    • Export generated class files and resources
    • Export java source files and resources
    • Compress the contents of the JAR file
    • Add directory entries
  3. Choose where to where to save your archive by clicking on Browse next to the box labelled JAR file. The convention is to name the JAR file project_name.jar where you replace project_name with your actual project's name.
  4. When it becomes active, click on Next. On this page, make sure you have selected
    • Export files with compile warnings
    • Build projects if not built automatically
  5. Click on Finish to actually create the JAR file.

Posting Your Project as an Applet

To run your project within a web page, you will need to include the following HTML tag within your page (you can type this into a text editor, like Notepad, but not a word processor, like Microsoft Word (when using Word, use the example page linked below instead)):

<applet
   code="Canvas"
archive="project_name.jar" width=600 height=600> </applet>

Where project_name.jar is replaced with the name of the JAR file made using the instructions above.

Here is an example page for you to use as a starting point; one is also included with each project you download through Eclipse. You can add text to this page to describe your project in any web page editor, just be careful when editting the tag itself.

Finally, when you copy your web page to your course web folder on acpub, make sure to copy both the JAR file you made for your project and the HTML page describing it.

Last updated Wed Nov 18 14:00:37 EST 2009