# Windows 7 Jar not running with double click

I have the following problem: I wrote a program in Java for a community and they're trying to run it. They installed Java and tried double clicking it but nothing happened.

Under my remote supervision, we tried the following things:

• Right click -> open with -> java(w)

• Control Panel -> Default Programs -> Associate a file type or protocol with a specific program -> .jar -> \path\to\java\bin\java(w).exe

• In CMD:

assoc .jar=jarfile
ftype jarfile="C:\path\to\java\bin\java(w).exe" -jar "%1" %*


All of the above once more after reinstalling java and rebooting, and also after deleting the registry key [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar]

All of these were tried with java.exe and javaw.exe.

It works without a problem in cmd.exe with java -jar program.jar.

I also tried to create a batch file with

@ECHO OFF
java -jar program.jar


that is in the same directory as my program. We also tried to do java.exe -jar program.jar (in the batch file).

When we used java, a cmd window popped up but nothing else happened; with javaw nothing happened. It was just that the mouse cursor switched to the loading symbol and then changed back. Afterwards, there were no java processes.

# EDIT

I had sent them an email where I told them to delete the jar and jar_auto_file classes from the registry in HKEY_CURRENT_USER/Software/Classes but it didn't help.

I just had another call with the community and I tried getting more information why the program crashes. So we added pause to the batch file but nothing special (considering the history of this pc) happened. The file looked like this:

@ECHO OFF
java.exe -jar progam.jar
pause


During the execution of this program, a console window popped up and disappeared once more. pause didn't work apparently...

I also tried to use cmd /k instead of pause or switched the last two lines (first cmd /k then java ...) to no avail.

The last try was starting cmd by hand and executing cmd /k program.bat (yes, the batch file) to see if it would give me an error message. But it simply repeated the path of the bat-file and that's it.

In the meantime, they installed java on a similarly configured pc and there, it worked like it normally would (java installed, double click on jar, done). So, I'm at the end of my wits, please tell me if you have any more ideas of what to test. Now it isn't so much about solving the problem for my customer but more a morbid interest in what the problem really is...

• @LotPings thanks, I'll take a look if it is this – Armin Jul 8 '18 at 15:39
• (1) You say you supervised them remotely.  I hate to insult anybody’s intelligence, but how sure are you that they are double-clicking correctly? (2) What, exactly, happened when you tried the things that you tried?  (I’m particularly interested in “Open With”.)  (3a) You almost never need to say .exe.  (3b) Putting the batch file in the same directory as the JAR file, by itself, does no good.  Try putting the path to the JAR file into the batch file; i.e., @ECHO OFF / java -jar C:\Users\Armin\program.jar.  (3c) Also, try adding a pause command to the end of the batch file. – Scott Jul 8 '18 at 15:58
• Please do not respond in comments; edit your question to make it clearer and more complete. – Scott Jul 8 '18 at 15:58
• P.S. As far as I know, PATHEXT has nothing to do with running programs through the GUI.  Am I wrong? – Scott Jul 8 '18 at 15:58
• @Scott I answered in comments because I'm going to test it, I haven't tested it, so I'm not going to include it as a tried path. It's the first time I heard of PATHEXT, so, I don't know... I'm sure it was correctly done because when we tried to do it with java instead of javaw, a CMD window popped up, which was mentioned in the question. The pause thing is actually a pretty good advice, thanks, I'll try that as well, maybe I can get more info this way... – Armin Jul 8 '18 at 16:02