Reputation: 5248
I need to import JSON library into netbeans.
How can I do that?
I searched on internet and I found this article.
According to this article when I import
import org.json.simple.JSONArray;
import org.json.simple.JSONObject
that, it must be work. But unfortunately it didn't work. and I get an error:
Package doesnt exist
Thanks for your help.
Upvotes: 10
Views: 55759
Reputation: 13
Or, instead of relying on the old version which uses the old import, use the newer version with the new import:
import com.github.cliftonlabs.json_simple.*;
For Netbeans, you can right click the project and go into Libraries to make sure the jar file is added into Classpath (not Modulepath). Press the '+' button to add it under that section by either by using a created library with the build jar and javadoc jar or, more simply, just adding the single jar file (json-simple-3.1.1.jar) directly to the classpath.
After doing this, the jar file should show up in the 'Libraries' folder under the project.
Upvotes: 0
Reputation: 148
Download jar from here : https://code.google.com/archive/p/json-simple/downloads And then add it to your "libraries" in netbeans.
Added this answer, because other answer didn't provide the above link, which is the easiest to download jar from.
Upvotes: 1
Reputation: 35
For this we have to add Class org.json.JSONObject which available in json-20131018.jar. We need to download this jar and add this jar to your buildpath.
for it in netbeans right click 'libraries' in the project list, then click add jar/folder.
Upvotes: 3
Reputation: 1
try add json-20131018.jar. This solved my problem. http://mvnrepository.com/artifact/org.json/json/20131018
Upvotes: 0
Reputation: 1650
As the article says you need to add the simple-json library to your project:
http://code.google.com/p/json-simple/
Upvotes: 6