Reputation: 33
i have prepared a java file that uses Json library so i downloaded a JSON library from "http://code.google.com/p/json-simple/downloads/detail?name=json_simple-1.1-all.zip&can=2&q=" but very confuse where to place it, so that my java file can detect Json library.
I tried to place the lib "json_simple-1.1" inside "C:\Program Files\Java\jdk1.6.0_07\lib" but not working yet.
How can i solve the problem using environment variable or any other means where i don't need to set path on comman prompt?
Upvotes: 0
Views: 2113
Reputation: 6203
Try the following:
set CLASSPATH=%CLASSPATH%;<path to libraries folder>
Upvotes: 0
Reputation: 7899
There are number of ways you can include jar file to run your program.
java -classpath "{yourpath}/json.jar:." my.package.Program
java -cp "{yourpath}/json.jar:." my.package.Program
Other way is to set env variable java.ext.dirs
.
-Djava.ext.dirs=jarDirectory
Upvotes: 1