2

I've searched through a great deal of posts regarding including jar files with a java file using linux (Ubuntu) and javac, while I've had some luck in finding how to do it, I haven't had any luck getting it to work (best response was here: How to include jar files with java file and compile in command prompt).

I'm simply trying to get json-simple-1.1.1.jar to import so that I can use JsonObject and JsonParser.

My directory structure is like so:

/java/lib/json-simple-1.1.1.jar

/java/name/example/JsonExample.java

The command I've seen results from is:

    javac -cp ".:../../lib/json-simple-1.1.1.jar" JsonExample.java
    error: error reading ../../lib/json-simple-1.1.1.jar; error in opening zip file

and when it seems to miss the jar file I get:

    JsonExample.java:5: error: package org.json.simple does not exist
    import org.json.simple.JsonObject;
    JsonExample.java:6: error: package org.json.simple does not exist
    import org.json.simple.JsonParser;

I'm using:

    import org.json.simple.JsonObject;
    import org.json.simple.JsonParser;

to import the classes I require from json-simple-1.1.1.jar

I have download json-simple from http://json-simple.googlecode.com/files/json-simple-1.1.1.jar and ensured that the file is complete and also removed and redownloaded it multiple times.

I would really appreciate any assistance anyone can offer as I have no idea where I'm going wrong here. Thanks, in advance!

Community
  • 1
  • 1
Hans
  • 531
  • 1
  • 4
  • 19

0 Answers0