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

Recommended Answers

All 5 Replies

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.

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
MyJar.jar

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.