This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am trying to run a jar file using the command prompt but get 'Unable to access jarfile' error.
I want to run the jar file from c:\, where as my jar file is in c:\apps\jar folder. I have classpath pointing to c:\apps\jar\myapp.jar but still get this error.
set classpath=c:\apps\jar\myapp.jar;%classpath% java -jar myapp.jar
It works if I run the command file from the same location where the jar file resides but not from other folder. The reason I do not want to test in same folder is because I will be scheduling this command file to run the java program using a scheduler.
Another problem is the path of any folder used inside the java program. I have log folder under c:\apps\jar & again I use relative path to access it in the java program. If I run the cmd file from c:\apps\jar folder, the java code works fine but if I run it from c:\, it doesnt work because I think it looks for log folder under c:\ rather than under c:\apps\jar.