Directory is like so:
test.html
blah
hmmm
Inside "blah" we have all the applet files, including blahBlah.class. Inside "hmmm" are a few more more class files that were taken from a library or something, they are used by the project also.
I write in test.html...
<applet name="blah" code="/blahBlah.class" codebase="blah"></applet>
(along with every other variation I could think of)
Farthest I've gotten is:
java.lang.NoClassDefFoundError: blahBlah (wrong name: blah/blahBlah)
Now inside blahBlah.java, we have:
package blah;
I'm not sure if it's related.
Also wondering if it may be necessary to place the project in a jar file and set the archive attribute of the applet?
The real files are not blah and blahBlah, but I've replaced the names faithfully.
java.lang.NoClassDefFoundError: blahBlah (wrong name: blah/blahBlah)
This basically means that it's been executed as
java blahBlah
instead of
java blah.blahBlah
In other words, your code
attribtue is wrong. It has to be
<applet name="blah" code="blah/blahBlah.class" />
or just by FQN (see also Andrew's comment)
<applet name="blah" code="blah.blahBlah" />
The codebase
defaults to the current folder, which is fine in this case, so it's removed. An alternative is to put it in another folder, such as /applet
or something. You should at least not use a package folder as code base, but instead the package root.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.