To post your game on the web so that others can play 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.
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.
File->Export->JAR file
).Next
and selecting the project to export, put
checks by the boxes for
Browse
next to the box labelled JAR file
. The convention is to name the JAR file your_game.jar
where you replace your_game
with your actual game
name.Next
. On this page, make sure
you have selectedFinish
to actually create the JAR file. To run your game within a web page, you will need to include the following tag within your page:
<applet code="your_game/YourGame"
archive="your_game.jar,fang.jar" width=410 height=465> </applet>
Where your_game
is
replaced with the name of the package in which you wrote your game,
YourGame
is replaced
with the name of the class which extends GameLoop
, and
your_game.jar
is the JAR file made
using the instructions above.
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 game and the file fang.jar
as well.