12

Possible Duplicate:
How can I convert my java program to an .exe file ?

How can I create an .exe file in NetBeans for a Java program?

I've had a look around, and I can make a JAR but not an exe.

Community
  • 1
  • 1
Tuffy G
  • 1,521
  • 8
  • 31
  • 42

3 Answers3

9

Have a look at JAR wrappers like Jar2Exe, JSmooth or Launch4j.

They will wrap your JAR inside an executable which role is to launch the JVM.

Gregory Pakosz
  • 69,011
  • 20
  • 139
  • 164
1

If it is Java. You may need another tool to pack an exe for your application. E.g. http://www.duckware.com/jexepack/index.html

Yin Zhu
  • 16,980
  • 13
  • 75
  • 117
1

There are wrappers like Launch4j that can wrap .jars into .exe launchers. However, even those require the JRE to be present in the system to work.

Joonas Pulakka
  • 36,252
  • 29
  • 106
  • 169
  • would i be able to include a jre installer with the exe so that both are installed? – Tuffy G Dec 29 '09 at 07:54
  • Yes, there are installers that can detect the presence of the JVM/JRE, and install it if necessary. Now that I look at it, JSmooth says it can automatically *download* a suitable JVM, so no need to bloat your installer package. Haven't tried it, though. – Joonas Pulakka Dec 29 '09 at 07:57
  • would an internet connection be needed for the installer to download it? or can i pack the jre installer to my exe? – Tuffy G Dec 29 '09 at 07:59
  • Yes, you need an internet connection to download anything. If it's likely that no connection will be available, then it's obviously better to bundle the JRE installer with your app. It should be easy, even with a non-Java-aware installer: JRE installer is just an exe to run. – Joonas Pulakka Dec 29 '09 at 08:03
  • this is going to sound stupid but what must th e minimum jre version be in launch4j? – Tuffy G Dec 29 '09 at 08:14
  • It doesn't seem to be mentioned directly at the website, so perhaps you should ask from the author. But I suspect that it's not that critical, and it's likely to work perfectly with not-so-recent JREs, if you really need to use a legacy JRE for some reason. – Joonas Pulakka Dec 29 '09 at 09:58
  • @Tuffy it is the minimum JVM version that your Java application has been compiled (and hopefully tested) to support. For more information, see http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html#options ... particularly the "-target" option. – Stephen C Dec 29 '09 at 10:02
  • thanks all. i think i'll stick to the jar and forget the exe – Tuffy G Dec 30 '09 at 19:07