Topic: Applets and the Web
- limitations of applets
1. no local file access (usually)
2. network access only to server
3. cannot access client information (RAM, etc)
4. no local executables - cannot run other programs
Lab: Exporting JAR in Eclipse
- right-click the project name, go to export
- new window opens, select JAR file under "Java" folder, click next,
- in next window make sure "Export generated class files and resources", "Export java source files and resources", "Compress the contents of the JAR file", "Add directory entries", and "Overwrite existing files without warning" are checked
- next select where to save the JAR file and what to call it (use browse button to find where you want to put it)
- click next, a new window will come up, click next again
- on the final screen make sure "Generate the manifest file" bullet is selected
- on the bottom input box for "Main class:" hit browse and select the project you are exporting from the list and select okay
- click finish
Lab: Adding an applet to your webpage
- go into the html/source editor of Composer (button in bottom left-hand corner of window)
- for single player games:
- for multiplayer games:
- note the width and height can be adjusted to whatever looks best
- for multiplayer the value of the two params can be adjusted based on how your game is designed
- the yourgame/YourGame.class and yorugame.jar are both CASE SENSITIVE and must be exactly as they are in the JAR fiel
- in the case of multiplayer games you need to adjust how you link to the page
- say my game is at http://www.duke.edu/~ak121/mygame.html
- then from my main page (index.html) when I link to my game I need to use the
URL http://server.fangengine.org:8080/~ak121/mygame.html instead of the Duke-based address