Importing JSON library into IntelliJ IDEA
Asked Answered
B

3

6

could you give me some tips about how to import this JSON lib by Doulgas Crockford to my IntelliJ IDEA? Thanks in advance. :)

Bristow answered 8/1, 2016 at 12:15 Comment(3)
What's exactly your problem? Checkout the project from github, create a jar and import it to your project..Weintrob
@JoelGeiser Ok, I did the first step, but I've encountered a problem while creating a jar file, since "Build Artifacts" button is N/A. I guess that is because there is no main method in the library?Bristow
You can import the java file direct into your source or compile the file with javac and create after a jar file to import. For this no main class is needed.Weintrob
V
18

I assume that you have already downloaded the JSON library. If not, you can download it from here: Maven repo

Go to File -> Project Structure... Then click on the Library tab on the left-hand side. You can add or remove any libraries. enter image description here

Vacationist answered 11/4, 2016 at 19:30 Comment(2)
How do you exactly download this library?Watt
You can download the .jar file from mvnrepository.com/artifact/org.json/json/20140107 and add it to IntelliJ as the answer suggested. This worked for me(2020.11.30)Cauvery
O
2

if you tried all the download links for the Json.jar and its probably not working you can check this link out

after the link loads, search in the table where you can find "file" at the right of it you will see different kinds of file types. Select jar and wait for it to download.

you can now add the downloaded json.jar file in your Intelij.

open your intelij IDE press CTRL + ALT + SHIFT + S

just by the left of the dialog select modules then from the tabs choose dependencies then hit the + choose JARs or Directories, a dialog is gonna pop up prompting you to select the file path or directory where you have your json.jar. in most cases the json.jar is located in the downloads folder for PC users since it was downloaded. So, select the directory that have your json.jar file, find the json.jar in the directory. Then, hit enter and apply then wait for it to sync.

Ovoviviparous answered 7/3, 2020 at 16:1 Comment(0)
C
2

If you still can not compile, you may need to add implementation 'org.json:json:20171018' in your build.gradle file's dependencies. Worked for me.

Cauvery answered 30/11, 2020 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.