I need my app to be executable without installed jre. It also uses rxtx, and there are different jars and dlls for 32- and 64-bit systems. Is there any Java AOT compiler for Windows, supporting 64-bit systems? All I've managed to google is that Excelsior Jet has some alpha version, but I can't figure out if (or how) can I make final exe there.
-
Gettting Java to run withtout an *installed* JRE is most easily done by *bundling* a JRE and producing a native launcher (using something like [launch4j](http://launch4j.sourceforge.net/)). True AOT-compilation that doesn't require a JRE is *hard* and rare. – Joachim Sauer Aug 27 '12 at 07:15
-
Forgot to mention, that large executables are not acceptable, too. And when bundling the whole jre you get more than 100 Mb. – Natalia Aug 27 '12 at 07:18
-
then provide the JRE as a .zip file and and unpack it during your installation process. The thing is that *most of the time* providing your own bundled JRE is going to be the easier solution. – Joachim Sauer Aug 27 '12 at 07:20
-
Guess I would have to do that if I won't find better solution( – Natalia Aug 27 '12 at 07:34
2 Answers
I would go with a combo of java to exe wrapper (e.g. Launch4j), JRE bundling and an installer builder (e.g. InnoSetup). Bundling a complete JRE adds only about 20MB to the installer (you may be able to shave off a few MB by stripping things you don't need from the JRE).
I'm using above combination to supply a (company private) application to subcontractors (which are usually complete computer dummies). You can manage all the target machine customization with the installer (e.g. set proper access rights on installed files for later updates).
You may also consider not deliver any specialized 64-bit version to cut down size. If the programm runs fine with a 32-bit VM, there is no added value for the user in a 64 bit (JRE) version. The difference in performance is neglible in most cases and if you have no use for exceptionally large heaps (>1GB) its a waste of time to supply an extra 64bit JRE.

- 19,919
- 4
- 36
- 70
-
How can I "shave off" unused things? I think I need 64-bit jre, because rxtx uses different jars for different platforms. Am I wrong? – Natalia Aug 27 '12 at 11:46
-
"Shave off" = delete things from the JRE installation you want to bundle. Examples would be stuff from the bin dir you won't need in a bundle (it will need some guesswork and trial to find out what you don't need. Candidates would be the exe's other than java/javaw in bin, plugins etc.). Test if you really need to install the 64bit version of rxtx (if you *use* a 32bit VM, the 32bit dll's most likely will work with it). Lastly, the cost of two JRE's may be less than double due to compression in the installer (try lzma/ultra64 in InnoSetup). – Durandal Aug 27 '12 at 13:29
-
And it may be also an option to just supply *two* installers, one for 32 and one for 64bit version. Depends on how smart your users can be expected to be. – Durandal Aug 27 '12 at 13:31
You could look at J9, it supports AOT and should exist in a 64 version according to IBM

- 4,023
- 1
- 19
- 12