0

I exported a runnable .jar file for a project of mine in Eclipse, but I can't seem to execute it with a double click. Running it from the command line with "java -jar program.jar" works fine, and while I could just leave a batch file to run it, it is rather annoying to do so. And double clicking some older jars that i've exported from Eclipse works fine. Anyone know how to fix this? I'm running windows 7 x64 btw(But i have 32-bit java)

EDIT: Ignore this question completely. It was a problem of me using 64 bit java in 32 bit eclipse, and the workarounds i may have used. Once I changed to 32 bit java, everything was fixed.

Rahat Ahmed
  • 2,191
  • 2
  • 30
  • 40

3 Answers3

0

On a Windows system, you will need to convert your .jar to an .exe file.

Please see How can I convert my Java program to an .exe file? for a good number of alternatives.

Community
  • 1
  • 1
rajah9
  • 11,645
  • 5
  • 44
  • 57
0

You can change this by setting javaw.exe to execute jar files.

My Computer > Tools > Folder Options > File Types

Find JAR in the list and change its 'opens with'.

Mike Kwan
  • 24,123
  • 12
  • 63
  • 96
0

If it's a console application then it probably won't open the command prompt on double click although the app may be running in the background. I recommend making batch files for console applications.

If its a Swing application and still won't run on double click you should try wrapping as an exe file using this http://launch4j.sourceforge.net/

Miretz
  • 154
  • 1
  • 12