Reputation: 1709
I downloaded a jar file and it was automatically saved to my downloads folder (I am using mac osx mountain lion). When I click on it, it automatically starts and everything is fine.
However, when i move the folder that contains the jar file and some other files to another directory (yep, I want to clean up my downloads folder) i am unable to start the jar file. I always get the error:
The Java JAR file "example.jar" could not be launched.
Check the Console for possible error messages.
What can i do to solve this problem?
EDIT: When I try to launch the jar file via the console i get this error:
Unable to access jarfile ./example.jar
Upvotes: 7
Views: 40342
Reputation: 8598
As @Pablo mentioned it could be because you have some other files/directories that are downloaded with the jar which you are not copying when you move your jar to a separate directory. To get around the problem you may want to try downloading the jar (along with whatever additional files/dirs etc.) directly to your desired folder and then launch the jar that way you won't miss anything that is required for launching.
Upvotes: 0
Reputation: 3016
I had the same problem, and I fixed it by making the jar file executable, e.g.
$ chmod +x blah.jar
Upvotes: 1
Reputation: 181270
It's probably the case that the JAR was downloaded along with other directory/files. So it's possible that some files are missing when you try to run the application.
Try opening a terminal and run:
$ java -jar name.jar
Where name.jar
is your JAR file.
Upvotes: 13