0

I have a simple java project with classes and many dependencies. I have copied all the jars in a lib folder in my project and added all those jars in the build path of my project.

enter image description here

However when I compile the main class only one jar org.json.* gives an exception saying cannot find symbol.

There are many jars which I have added in the same way but none of them gives exception while compilation.

Main class runs in eclipse.

What am I doing wrong? Please correct me

EDIT:

I tried to compile different classes. It is showing 'Symbol doesn't exist' for all dependency objects in jars. So am I packing the jar different way?

Raghunandan J
  • 584
  • 1
  • 6
  • 22
  • 1
    Looks like one jar is missing in your classpath if you run it from command line – Jens Aug 17 '16 at 05:32
  • 1
    I'll advice you to use build tool like Gradle/Maven. – seenukarthi Aug 17 '16 at 05:35
  • I had used maven initially then there were dependency problems which I couldn't even resolve for days!. Then switched to ANT build, that was again invain. So just copied all the classes and made a simple java project – Raghunandan J Aug 17 '16 at 05:52
  • maybe the JSON lib (jar) you are using is not the correct one, maybe you need a newer/older version or even different lib, if package naming is not the same as the one you are trying to use, you can check jar file content using Winrar for ex. and see if this package is exist `org.json....` – Yazan Aug 17 '16 at 06:12
  • Just downloaded and updated the jar again from central maven repo. Still same result... – Raghunandan J Aug 17 '16 at 08:07
  • @RaghunandanJ For me the issue comes if the JAR files are in subdirectories. Also, I had to add referenced libraries as dependency (eg. Apache JSTL library). Are any of these maybe to blame? Check out the answers in the following "Java Multiple JARs in Classpath" question: http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath – Osmund Francis Aug 18 '16 at 17:13

0 Answers0