Reputation: 113
I have a requirement to load JSON file and work on the data set. Below is my test code.
For JSON-P jar file I went to JSR 353
and downloaded javax.json-api-1.0-javadoc.jar
. I added this jar to the build path. But I still get the error;
JsonReader unable to resolve to a type
One thing I noticed is after adding the jar, I can add import javax.json.*
but not individual classes
import java.io.*;
import javax.json.*;
public class Test {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println("File Name: " + args[0]);
String fileName = args[0];
FileInputStream in = new FileInputStream(fileName);
JsonReader jReader = Json.createReader( in ); in .close();
}
}
Upvotes: 0
Views: 153
Reputation: 1852
You should add javax.json-api-1.0.jar
file to your classpath instead of javax.json-api-1.0-javadoc.jar
. The file you've added contains Javadoc of the source code, this will not help you load th e class you want.
You can download the required file from following url.
http://central.maven.org/maven2/javax/json/javax.json-api/1.0/
P.S. - Try to use Maven instead. it'll be easy for you.
Upvotes: 3