When I download a .jar file to say install a mod to minecraft and double click it, it doesn't run. The loading wheel goes for like two seconds and then stops, and nothing else happens. The .jar I know is set up right because it runs through cmd with the command
cd "wherever the file is"
java -jar "file name".jar
So I've already tried to run it with the default program set as javaw.exe in the java\jdk1.7.0_25\jre\bin. Same where nothing happens. So the file association is set to the right place. I am at a loss here.
It isn't so bad since I can still run them through cmd, but when I get to the part in the book about jars, I want to be able to run it through the Windows Explorer GUI, which is like half the benefit of using .jar files that I can see.
Is it possibly a registry error? I have seen a lot of questions specifically about this problem, but most of them it seems were problems with setting up the .jar, which I didn't do, and I don't think that is the case here.
I have Windows Vista 64bit.
If I wasn't specific enough, feel free to ask.
If the program runs in the CMD but will not when double clicked, it seems like the correct data (parameters) is not being passed along when double clicking. Here's the command I use to run the program in the CMD: java -jar DigitalClock.jar
I can't get JAVA .jar files to run by double clicking on my Windows 10 computer. They will open when run in the CMD, so I believe there is not a problem with the files. The jar files run perfectly on my 2 Windows 7 computers. The jar files are examples included with Netbeans.
Option 1: Specify the dependencies while running the jar in the command line: Normally the developers who create the jar should specify its dependencies inside the manifest, but in case they forgot and you don’t have other way to run the jar, just add the following attribute just before the main class attribute in MANIFEST.MF: 4.
This error means that the version of the JDK used for developing the jar is greater than the JRE version currently used to run it. Beware that java is backward compatible, so always make sure that the JRE version of running environment is greater than or equal to the JDK version used for development.
I had the same problem, and it turns out that the .jar file association in the registry was broken. The following steps fixed it:
HKEY_CLASSES_ROOT\jarfile\shell\open\command
, and modify the value of the Default key as follows[Location of your JRE]
in "[Location of your JRE]\bin\javaw.exe" -jar "%1" %*
with the root directory of your JRE
installation. For example, "C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*
.HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jarfile\shell\open\command
.I have a Windows 7 machine, but I assume this would work for 32-bit environments as well.
EDIT: Fixed the path in the example - it should use the "Program Files" directory and not "Program Files (x86)".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With