LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   can run java -jar in Downloads directory, but not one made off my home (https://www.linuxquestions.org/questions/linux-desktop-74/can-run-java-jar-in-downloads-directory-but-not-one-made-off-my-home-4175470532/)

MikeyXX 07-22-2013 02:43 PM

can run java -jar in Downloads directory, but not one made off my home
 
It's weird, if I run java -jar on a .jar file in a directory I created under my home directory, it says it can't access the .jar file. But if I move the .jar file to the Downloads directory, it works just fine. Here is a permission list of the two directories:

drwxrwxrwx 3 michael michael 4096 Jul 22 14:44 Downloads

drwxrwxrwx 4 michael michael 4096 Jul 22 14:44 Ducky

If I run the "java -jar jarfile.jar" within Ducky, it comes back saying it cannot access the file jarfile.jar. But if I copy the file out of there, put it in Downloads, and then copy it back. It works. The permissions change it seems as the colour of original file was red and the newly copied file is green. I don't know why it was working.

Can anyone explain it? (type slowly please :) )

John VV 07-22-2013 03:25 PM

well with out more info
This is only a wild guess

the "Downloads" folder is in your users $PATH
and the random named folder is NOT

by the way are you using a ./ in the command line to tell the terminal to USE the folder you are in
Code:

cd ~/FolderName
java -jar ./jarfile.jar


MikeyXX 07-22-2013 06:01 PM

Thanks John, that was my first thought. I echo'd the $PATH variable and neither show up in it. And I did run it as you indicated as one of my attempts. Interesting update. I moved the .jar file back from Downloads and into the Ducky directory...and now it works, it can be accessed by the java. How wierd is that?


All times are GMT -5. The time now is 05:12 AM.