-1

I have an issue , i need to use json for java and i try to import a it's library by this way :

import org.json.simple.JSONObject;

but it don't work , it says that the package org.json.simple does not exist .

any help please

(I use netbeans)

7
  • What build tool are you using? MAven or ant? Commented Jul 21, 2014 at 23:34
  • hem , no one , in fact i don't know what are you talking about , i have searched and i ound that it has something to do with maven but i couldn't understund , please explain to me . Commented Jul 21, 2014 at 23:36
  • org.json. doesn't belong to standard Java packages. You need to download it and add to project classpath. Commented Jul 21, 2014 at 23:37
  • If you or not using maven or ant, your project still has a library/class folder. You need to put the json jar into your class/lib folder Commented Jul 21, 2014 at 23:37
  • i have tried to import the jar file as a library but it's not working too ?? Commented Jul 21, 2014 at 23:38

1 Answer 1

2

Using a class that is not in part of the standard JAva library requires a bit more than just importing it by way of an import statement. The most direct way to accomplish this is to download a jar file to the local environment and add the jar to your build path. Alternatively, you can use a tool like Maven to manage your dependencies, but this is a bit more involved.

SimpleJSON can be downloaded from [here}(https://code.google.com/p/json-simple/downloads/list). Adding it to your build path depends on the IDE you are using, but instructions should be readily available on the interwebs.

Noticed you stated you used Netbeans

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

1 Comment

thank you, i've done what you said but it steel not working , when i creat an object from a class of the imported jar , it's says that the class don't exist

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.