Adding a jar file to CLASSPATH is still not executable

Posted by Simon O'Hanlon on Super User See other posts from Super User or by Simon O'Hanlon
Published on 2014-06-02T16:02:16Z Indexed on 2014/06/02 21:32 UTC
Read the original article Hit count: 332

Filed under:
|
|
|
|

Perhaps I just don't understand how the whole CLASSPATH environment variable works when trying to find .jar files on your system. I thought if you specified it, you could launch .jar files with java in much the same way that you can launch executables that are on your path.

I have an executable java archive (.jar file) on my system, that I stuck in /usr/local/bin/gatk/. I added this to my CLASSPATH via:

export CLASSPATH=/usr/local/bin/gatk/GenomeAnalysisTK.jar

I thought this would make the .jar file visible to my JVM. When I try to invoke it with

java -jar GenomeAnalysisTK.jar
#Error: Unable to access jarfile .gatk/GenomeAnalysisTK.jar

I can invoke it setting the absolute path, e.g.
java -jar /usr/local/bin/gatk/GenomeAnalysisTK.jar, however I'd rather not type the full path each time. I have read many of the linked tutorials but somehow I don't seem to be getting this right and I can't understand what I am doing wrong.

© Super User or respective owner

Related posts about linux

Related posts about java