I'm trying to run a jar that is located at /Library/Java/jack.jar, this works:
java -jar /Library/Java/jack.jar
However, I want to run it without the path, relying on the class path. The default class path includes /Library/Java, but this fails with "Unable to access jarfile":
java -jar jack.jar
Why? What's more, this also fails (same error):
java -cp /Library/Java -jar jack.jar
What's the problem/what am I doing wrong?
Thanks.
From http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/java.html:
The jar file can not be executed this way. You need to provide the full path of the jar file. the class path
-cp classpath
specifies a list of directories, JAR archives, and ZIP archives to search for class files needed to run your java program. However, the jar file to be executed should be accessed using full path. After the jar file is run, the classpath can be used to locate more classes and libraries.By the way, this is not the right site to ask such a question.