1
votes

I have some code I posted about earlier (converting into an application) that was working as an applet, but has since mysteriously ceased to work outside of an IDE applet viewer.

Code here: http://www.mediafire.com/?4eslqqr4aoh33j1

After compiling the code into a .jar file and uploading that file to my site (www.insertnamestudios.com/lib), I am trying to embed the applet in a different site. I thought it was working okay, but apparently it isn't. The HTML code I am using to embed is

<applet codebase="www.insertnamestudios.com/lib" 
code=ins.awp.game.AWPASG.class archive="AWPASG.jar"
width=1024 height=720>
</applet>

But I continuously get the error:

load: class ins.awp.game.AWPASG.class not found. java.lang.ClassNotFoundException: ins.awp.game.AWPASG.class at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

I'm not sure why I get this error as the codebase is pointed to the right location, and the AWPASG.class file is in the .jar (I've decompiled and checked). Did I miss something in the actual applet itself? I don't think I need to give it any extra permissions or anything, but I could be mistaken.

I've tried the solutions I've found from Google, including removing the .class extension, but continue to get this same error regardless of what I've tried with HTML.

1
When you say that the AWPASG.class is in the jar, is it under a directory structure (inside the jar) of ins/awp/game?Highland Mark

1 Answers

0
votes

That codebase is not a valid URL as far as the JRE understands it. Change it to

codebase="http://www.insertnamestudios.com/lib" 

On a more general note, use deployJava.js to write the applet element.

Another answer (now deleted) also advises removing the .class extension. That is correct advice, the .class extension is tolerated, as opposed to being correct.