We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey guys,
I need some help on embedding my Applet (written in Eclipse with the Processing Library) on a simple html file.
I used this code in the html file:
<html>
<body>
<head>
<title>Java Example</title>
</head><p>
This is the IPCam Applet</p><br>
<br>
<embed id="testapplet" type="application/x-java-applet;version=1.7" width="320" height="240" archive="test.jar" code="Test.class" pluginspage="http://java.com/download/" myParam="My Param Value" />
</body>
</html>
I also tried:
<applet code="Test.class" archive="test.jar"></applet>
The html and the jar file are located in the same directory. Within the project all classes are in the default package.
My little Java Project can be found using this link: http://www.computer-schuppen.eu/files/ipcapture.zip
As soon as I open the html with Firefox, Internet Explorer or Chrome I receive the error : NoClassDefFoundError - processing/core/PApplet
I'm thankful for any help!
Answers
You have to specify the core.jar in the HTML tag and to add it beside your own jar.
Thanks for your reply PhiLho
What kind of tag is supposed to be made for adding the core.jar ? Another archive tag does not work, like:
<applet code="Test.class" archive="test.jar" archive="core.jar"></applet>
Isn't it just enough that the core.jar is added in the Buildpath in Eclipse? Does this affect my other two classes in my project?
HTML doesn't support multiple attributes in a tag! Try archive="test.jar,core.jar"
Note that the applet tag is deprecated, in favor of the object tag.
Thanks for your reply.
This works just fine. But I'll give the object tag a try as well. ( http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html#edef-OBJECT )
I just recently tested my Java Program for displaying the output of an IPCam. It is working in Eclipse but I can't make it work on the applet.
I added all jars of all my needed classes.
I imported several libraries in my IPCapture Class:
The applet doesn't show anything on runtime.
What might be the problem?
edit: This is the entire Eclipse Project: https://www.dropbox.com/s/r9gxc8bfqhhy1hu/ipcapture.zip
edit2: I tried to add the rt.jar and another jar which contains all the libraries. It didn't work out unfortunately.
Sketches using hardware / IO must have their jar signed to run on the Web.
Note that online applets using a specific hardware are prone to be used by a very limited category of visitors...
The Applet is supposed to work on just one specific network, which has the IPCam hooked up.
So the applet should be able to work on each Computer within the network. The program belongs to a project during my field of studies at University.
How could this be accomplished?
"How could this be accomplished?"
One way to do that is to search sign jar on Internet...
There are also instructions in the Processing wiki: Sign an Applet
Signing the applet did not solve the problem. :(
edit: Signing ALL jars worked.