Jar -> EXE

I haven’t really bothered with this until now.
I want to be able to make EXE files that run my Java application.

I’ve seen games made with Java run with EXE files. Is there a method that is troublefree? I have read that people go to a lot of trouble with this.

Thanks

Hi
There are a couple of options that I know of. Jet is a commercial java to exe compiler, I think it’s quite expensive, but has the best results, GCJ is a free one, but has no swing support. As far as I know none of them will work with java3d. I don’t know how they handle JNI interfaces (if you are using jogl, joal, or jinput for example). You also throw away one of the major advantages of java. It’s cross platform abilities (if exe is the only way you want to distro it). You could create a native installer though. Install anywhere was free for non commercial use last time I looked, and seemed easy to use, the process for the end user is nice and simple to install the apps, and you can give them the choice of an install with or without a vm.

HTH

Endolf

EDIT: Typo on GCJ.

GCJ
JET

I think you guys are assuming he wants to compile his code which is not what I read.

You don’t HAVE to compile your code to get a .exe that will launch your app. There are quite a few “Java launchers” out there that will allow you to create an exe the user can run that will in turn launch the vm and your app. These are included in such products as InstallAnywhere and InstallSheild but there are also slightly less easy to use free ones (try Sourceforge at a guess.)

There used to be a free level of InstallAnywhere that had this capability but I don’t know if it exists anymore…

Yep it does. Its called InstallAnywhere NOW!

It at least used to do this as well as build installers for you.

Hi
It does indeed, thats why I mentioned it :), I have some old VM packs lying around if your after java3d in the install. Otherwise the Zero G website has VM packs for various other OSs

Cheers

Endolf

Consider writing a simple java class that starts your main java program, and them compile that. An .exe for people to click on - no command-line parameters to fool around with. No worries about which API’s it supports, so long as it supports the “java.lang.Runtime.exec()” method…

Of course, this means you’d still have to distribute a JRE with your program (or somehow determine whether the user already had it installed or not).

Hm, I guess this is [EDIT:] exactly what Jeff was talking about. One might wonder if I even read his post. :stuck_out_tongue: With GCJ, you should be able to create an executable launcher program for many platforms.

Hey, maybe I’ll do one myself, just for kicks.

JNI contains a call to launcha VM from C.

I believe there are a number of freeware portable C Java launchers out there which is why I suggested a quick Sourceforge search… (or a Google.)

Myself, I’d use Install Anywhere Now. Its easy to use, free, and (assuming they fix the Mac installer/JDK1.4.2 bug) will make launchers for PC/Linux/Mac/Solaris already

Actualy Install Anywhere Now sounds good to me to get the base install going.

My installation is built around a simple base package which includes an installer for getting the most recent packages (and hopefully when I get my own classloader running, to load them at runtime)

This will help me make sure the correct VM is installed.
(and yes, webstart can do that too, but not for every platform right?)