-1

First of all, Java noob. I'm trying to decode a JSON string. I got the package json-20160810.jar and copied it to C:\Program Files\Java\jre1.8.0_112\lib\ext but java says it doesn't exist. I tried changing CLASSPATH to the same path as well. I'm not using any IDE

I even tried copying it to \Java\jre1.8.0_91\lib\ext and \Java\jdk1.8.0_112\bin

Lord Stiltskin
  • 133
  • 1
  • 8
  • Is the error at compile time or run time? How are you running whatever command is failing? – yshavit Nov 21 '16 at 03:03
  • Is there a specific reason for not using an IDE? A remark: the classpath should include the JAR file, not only its directory. – Gabor Szarnyas Nov 21 '16 at 03:08
  • Don't put your own JARs into the extensions directory. That's not what it's for. – user207421 Nov 21 '16 at 04:11
  • If you have both, a JRE and a JDK installed, you have to care which one is used. `javac` is part of the JDK, hence, uses the JRE embedded in the JDK, `\Java\jdk1.8.0_112\jre`, so the extension folder used by it, is `\Java\jdk1.8.0_112\jre\lib\ext`. But remember that when you *run* the application, it will use the extension folder of the JRE you use for running it, e.g. `\Java\jre1.8.0_112\lib\ext` or `\Java\jre1.8.0_91\lib\ext` or whatever JRE you have additionally installed. That’s why the extension folder is not the appropriate folder for such a library (and it will vanish in Java 9). – Holger Nov 21 '16 at 10:40

1 Answers1

1

try the following command:

javac -classpath ".;home/path/json-20160810.jar" yourJavaFile.java

Kuri
  • 109
  • 1
  • 8