Adding a jar file to CLASSPATH is still not executable
- by Simon O'Hanlon
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.