2

I'm trying to embed a Java applet that I just made into an HTML 5 compliant page. I'm using the following tag to embed the .jar file:

<object type="application/x-java-applet" height="300" width="550">
      <param name="code" value="MainClassName" />
      <param name="archive" value="MyJarFileName.jar" />
      Applet failed to run.  No Java plug-in was found.
</object>

The java applet will try to run but stop with:

java.lang.reflect.InvocationTargetException

I'm having trouble finding what is the cause of this error. My .jar file will run fine on its own. The main class extends JApplet, which contains a frame, which contains a JPanel.

What is causing this error?

6
  • this could help: stackoverflow.com/questions/6955790/…
    – kennypu
    Dec 29, 2012 at 3:16
  • 1
    1) InvocationTargetException is often caused by the applet not being declared public. 2) Use deployJava.js to write the element. 3) If the applet is available at a public URL where we can visit it, supply the URL. 4) "extends JApplet, which contains a frame, which contains a JPanel." What exactly DYM by 'frame'? An applet should not typically be launching a JFrame or Frame. Dec 29, 2012 at 3:33
  • That was exactly it, my main constructor was private. Now I don't get an error but it wont load. The example that i saw in eyeasme.com/Shayne/HTML5_APPLETS/Sample.java does the same thing I did: create a Frame from the Main class which extends JApplet
    – nwnoga
    Dec 29, 2012 at 4:20
  • I just threw it up here:dl.dropbox.com/u/38434655/index.html
    – nwnoga
    Dec 29, 2012 at 4:31
  • @nwnoga: Please edit your question to cite your sources and include an sscce that exhibits the current problem. It's unlikely that anyone will endure dropbox see your code. Also consider javawebstart and a hybrid applet/application.
    – trashgod
    Dec 29, 2012 at 11:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.