I have hello.jar which I want to execute by just specifying "hello.jar" or by double-clicking it and not by giving java -jar
command. But this is not happening.
Below is the error that I am getting:-
As you can see from the above screenshot, java -jar hello.jar
is working fine which means class path is not the problem.
Below is the structure of the JAR:-
And the contents of the MANIFEST.MF are as follows:-
Manifest-Version: 1.0
Main-Class: hello.Main
Below are the details of my environment:- OS: Windows 7 Premium. Java: Java 7.
I have tried following approach as suggested by @Haloboy but it did not work:-
- Start "Control Panel"
- Click "Default Programs"
- Click "Associate a file type or protocol with a specific program"
- Double click .jar
- Browse to: C:\Program Files\Java\jre7\bin\javaw.exe for 32 bit Windows 7 or C:\Program Files (x86)\Java\jre7\bin\javaw.exe for 64 bit Windows 7
- Click the Open button
- Click the Ok button
Have tried solutins mentioned here and here but no success.
Any help/pointers on how to associate a JAR file with 'java -jar'
will be helpful.