Hi all!
Happily working my way through Java 1.4 Game Programming when i hit a stump. The book describes methods to create a .jar file with command line entry and run it with an HTML file, however I have been following along using Eclipse.
This is the java class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| package game.programming.tutorial;
import java.awt.*; import javax.swing.*; public class MyApplet extends JApplet {
public void init() { setSize(400, 300); } public void start() { } public void paint(Graphics g) { g.drawString("Text to Screen", 20, 20); } public void stop() { } public void destroy() { } } |
This is the HTML file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <HTML> <HEAD> <TITLE>Applet JAR Example</TITLE> </HEAD> <BODY> <CENTER><B>Applet JAR Example</B> <BR> <APPLET CODE="MyApplet.class" ARCHIVE="MyApplet.jar" WIDTH=400 HEIGHT=300> </APPLET> </CENTER> </BODY> </HTML> |
When I export from eclipse I do the following...
-Right click class(context: Export)
-Select JAR file.
Next
-Resources to export (MyApplet.java is the only one ticked)
-Export generated class files and resources ticked
-compress the contents of the JAR file ticked
Next
-Export class errors ticked
-Export class warnings ticked
Next
-Generate the Manifest ticked
-Seal some packages ticked
Finish
At this point I have a folder on my desktop "AppletTest"
This contains,
AppletTest.html
MyApplet.jar
Double clicking the html file loads in my web browser as expected however the applet window just states,
Error: click for details, which show nothing upon clicking.
Any help would be much appreciated,
Thank You.