I know that
export CLASSPATH=/usr/local/java/tools.jar:$CLASSPATH will add tools.jar to the CLASSPATH, but i want to set folder to the CLASSPATH
but its not working.
First, in general, setting the env var
When you have specific, individual apps that do require that the classpath be set, then usually the command-line option is preferred:
That being said (and since there are always exceptions to the rule), then depending on the version of java (this requres java 6 or later), you can specify that a whole directory of jars be added to the classpath by adding a "
In general, if you have to add a whole directory of jars to the application's classpath, the app was not bundled correctly. Rather, the app should have a manifest containing the list of jars it depends on. Or at the very least, only one jar should be added to your classpath, and that jar can have in its manifest the whole list of jars in some subdirectory.
if you want to set classpath permanently then 1) find out where java is installed.. you may use "whereis java" openjdk-7/6 is in /usr/lib/jvm/.....
2) we need to set up CLASSPATH in /etc/environment
3) add the following likes .. ( DONT LEAVE ANY SPACES WHILE TYPING)(customize according to your java version and installation) (this home path is for open jdk 7)
separate directory by ":"
open terminal and type
add all the exports you need like ...
finally restart terminal for changes to take effect