views:

479

answers:

3

hi.

anyone know how to create a .exe in netbeans?

i've had a look around and i can make a jar but not an exe.

A: 

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
+4  A: 

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
+1  A: 

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
would i be able to include a jre installer with the exe so that both are installed?
Tuffy G
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
would an internet connection be needed for the installer to download it? or can i pack the jre installer to my exe?
Tuffy G
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
this is going to sound stupid but what must th e minimum jre version be in launch4j?
Tuffy G
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
@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
thanks all.i think i'll stick to the jar and forget the exe
Tuffy G