Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I unable to launch a jar file?

Tags:

java

file

jar

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
like image 651
user1420042 Avatar asked Jan 21 '13 15:01

user1420042


People also ask

Why JAR file is not opening?

To open a jar file in Windows, you must have the Java Runtime Environment installed. Alternatively, you can use decompression software, such as an unzip utility, to view the files in the jar archive.

Why can I not open JAR files on Windows 11?

On Windows 10 and Windows 11, JAR files don't open by default as there are no built-in apps to handle this file format. But, you can install the free Java utility and access this file format on your PC.


1 Answers

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.

like image 93
Pablo Santa Cruz Avatar answered Oct 26 '22 02:10

Pablo Santa Cruz