How can I import javax.json in eclipse

You need to get a hold of the Jar from https://java.net/projects/jsonp/

Then got to project folder -> clicked properties -> clicked Java build path -> Add External Jars...

From here you can import the downloaded Jar (library) into your project.


If using Maven, add this dependency to your pom.xml

<dependency>
    <groupId>javax.json</groupId>
    <artifactId>javax.json-api</artifactId>
    <version>1.0</version>
</dependency>

For Gradle, add this to your build.gradle

compile 'javax.json:javax.json-api:1.0'

Using javax.json group (what is in the accepted version) doesn't work for me. I get this:

javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found

Instead, what does work for me is the following (put this in the dependencies section of build.gradle if you're using Gradle):

implementation "org.glassfish:javax.json:1.1.4"

To find the latest version of the library, see the library's search.maven.org page.


Going to assume that you are not using Java 7 and thus need to add the JAR file directly to your project path:

Here's the link to the JAR

And where it came from: http://jsonp.java.net/

Download and add to your project build path.

Tags:

Java

Eclipse

Json