4

Similar questions have been asked here about this error, but I have tried most of the solutions and still get the same error message. I'm using json-simple library in my java app. I have included the json-simple-1.1.1.jar file in my library. Running through Netbeans works perfectly. When I try running it through the command line "java -jar " I get the following error. Even "java -cp json-simple-1.1.1.jar -jar still give the same error.

nullException in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/json/simple/JSONObject
    at gui.keo_synopticx.jb_save_configMouseClicked(keo_synopticx.java:5318)
    at gui.keo_synopticx.access$6000(keo_synopticx.java:49)
    at gui.keo_synopticx$60.mouseClicked(keo_synopticx.java:3358)
    at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.json.simple.JSONObject
    at java.net.URLClassLoader$1.run(Unknown Source)

I may be missing a dependency for json-simple-1.1.1? Any advice would be greatly appreciated.

1
  • Manually adding json-simple-1.1.1.jar to the Class-Path in the manifest.mf still creates the same error message. Commented Mar 4, 2013 at 19:14

2 Answers 2

1

The org/json/simple/JSONObject class is definitely in the jar file.

The only reason for the problem I can think of is that you did not specify the jar file path, and that the jar is not in the same directory as your execution directory.

Sign up to request clarification or add additional context in comments.

1 Comment

exactly, the main classpath configuration is given by netbeans in its config file.
0

To solve this issue you should precise your classpath on the terminal:

syntaxe:

java -classpath <your_archive.jar> [<package>.]<Class_name>

don't forget the package if the class belongs to one.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.