I tried a lot to open a JAR file but it is not opening.I typed in command prompt

javaw -jar MyJar.jar but it is not open. It makes some error sound bt not open.

Please help me regard this

java -jar <MyJar.jar> ....(will only work for executable jar files. Not all jar files are executable)

or if you still have a problem then it will most probably be a class path problem. If you still have a problem tell me.

Edited 6 Years Ago by Akill10: n/a

It makes some error sound

use the java command instead of javaw and you should get an error message on the screen.
Copy and paste the message here if you have questions about it.
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

When I execute the jar file in cmd as you said like:
java -jar MyJar.jar

Failed to load Main-Class manifest attribute from

And when I simply double clicked on the particular jar file its give a error sound and nothing happened.I already set the java path and jre path in the "environmental variables" section.

Through Netbeans I create the jar file

Edited 6 Years Ago by subrat_p: n/a

Failed to load Main-Class manifest attribute

Look in the jar file (use a zip utility) and see if it has a manifest file and if the manifest file has a Main-Class: record.
The java program can not find it.

Sorry, I have no idea how to use your IDE.

In Netbeans, you can open the project properties and look at the "Run" category. There is an entry for Main Class there. Be sure that is set to the class you are wanting to run and then clean and build your project.

This article has been dead for over six months. Start a new discussion instead.