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.
Hi, I have a jar file in the following subdirectory on my home directory: app/application.jar In order to run application jar in any directory, I have to set classpath, right? How can I set appropriate class on linux to all me to run it directly, for example, from my home directory like this? [home]$ java -jar application.jar I am not familiar with this on Linux, any help appreciated.
Originally posted by Frank Carver: I don't think you need to set the classpath for this. Why not just use the full path to the jarfile? java -jar /home/myname/app/application.jar
Thanks. The trouble is the data file has to sit on the same directory as application.jar, the access to it will be refused if I do not execute the application from subdirectory app. I try to set classpath like this: export CLASSPATH=/home/myname/app/application.jar the I use the following command to execute it: java -jar -classpath application.jar It did not work, I ma not sure if I did not set the right classpath, or my command was not right. Any ideas?