Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I import javax.json in eclipse

Tags:

java

json

eclipse

I have installed eclipse ide for EE developers and I am receiving an import error for

import javax.json.Json; import javax.json.JsonReader; etc. 

I have right clicked on project folder -> clicked properties -> clicked Java build path -> add library -> JRE System Library,

but the dependencies that show up are already imported. How can I import the javax.json package?

like image 445
user1876508 Avatar asked Aug 20 '13 23:08

user1876508


People also ask

What is javax JSON?

The javax. json package provides an Object Model API to process JSON. The Object Model API is a high-level API that provides immutable object models for JSON object and array structures. These JSON structures can be represented as object models using JsonObject and JsonArray interfaces.


2 Answers

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' 
like image 169
user2601995 Avatar answered Sep 28 '22 06:09

user2601995


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.

like image 32
dispake Avatar answered Sep 28 '22 05:09

dispake