Hi,
export CLASSPATH=.;../somejar.jar;../mysql-connector-java-5.1.6-bin.jar
java -Xmx500m folder.subfolder../dit1/some.xml
cd ..
is the above statement for setting the classpath to already existing classpath in linux is correct or not
Hi,
export CLASSPATH=.;../somejar.jar;../mysql-connector-java-5.1.6-bin.jar
java -Xmx500m folder.subfolder../dit1/some.xml
cd ..
is the above statement for setting the classpath to already existing classpath in linux is correct or not
Its always advised to never destructively destroy an existing classpath unless you have a good reason.
export CLASSPATH="$CLASSPATH:foo.jar:../bar.jar"
Paths under linux are separated by colons (:
), not semi-colons (;
), as theatrus correctly used it in his example. I believe Java respects this convention.
Alternatively to what andy suggested, you may use the following form (which sets CLASSPATH for the duration of the command):
CLASSPATH=".:../somejar.jar:../mysql-connector-java-5.1.6-bin.jar" java -Xmx500m ...
whichever is more convenient to you.
I don't like setting CLASSPATH. CLASSPATH is a global variable and as such it is evil:
Therefore the prefered way is to set the classpath per each run of the jvm, for example:
java -Xmx500m -cp ".:../somejar.jar:../mysql-connector-java-5.1.6-bin.jar" "folder.subfolder../dit1/some.xml
If it gets long the standard procedure is to wrap it in a bash or batch script to save typing.