简体   繁体   中英

JApplet java.lang.NoClassDefFoundError: org/json/JSONException

I have this JApplet jar and tried to open it on the web. But I keep getting this error

java.lang.NoClassDefFoundError: org/json/JSONException

I've searched the answers here and tried them, but didn't work. Even if I already added the java-json.jar in my build path of the project.

this is my html code for running my jar file on the web

<applet archive="PDDS.jar" code="MainFrame.class" width="960" height="540">

I have two classes inside PDDS.jar, the JApplet class is the MainFrame.class, the other one is a class for connecting to the sqlite database.

Even if I already added the java-json.jar in my build path of the project.

The build path of a project has nothing to do with the runtime class path, which is set in the applet element.

So..

<applet archive="PDDS.jar" code="MainFrame.class" width="960" height="540">

Should be more like..

<applet archive="PDDS.jar java-json.jar" code="MainFrame.class" width="960" height="540">

Note also that the code attribute should best be the fully qualified name of the applet class, not the file name, so it would look like:

<applet archive="PDDS.jar java-json.jar" code="MainFrame" width="960" height="540">

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM