I have to burn a Java application on a CD. This application have to run on every Windows PC wihtout any installation (also JRE shouldn't be installed) before.

- 64,767
- 30
- 146
- 239

- 2,953
- 11
- 54
- 108
-
1I'm starting to think this is essentially same as: http://stackoverflow.com/questions/2258932/embed-a-jre-in-a-windows-executable Both are about distributing a Java app as Windows .exe launcher (with JRE bundled in). – Jonik Apr 26 '10 at 11:06
-
1I'm not focused on getting a .exe-file. I'm only want to run the jre without the jdk. I solved it with a batch-file and startet with the command jdk/java.exe bla.jar – rakete May 06 '10 at 14:38
6 Answers
I guess you could copy the JRE from your programs folder onto the CD too. Then, add a batch script to use your "local" JRE to start your app. That should be enough, but I don't know if this works with all versions of windows.

- 11,867
- 4
- 35
- 50
-
The problem isn't Windows, that will happily run a Win32 PE executable from anywhere. But does the JRE make additional assumptions? – MSalters Apr 26 '10 at 11:20
You'd have to bundle jre on disk and create startup scripts. If you are not satisfied with simple batch / shell startup scripts you can use something like JLauncher to create "real" executable.

- 30,263
- 18
- 74
- 108
-
1+1. If a commercial tool is ok, install4j is good for creating a .exe launcher (with bundled JRE) for Java apps. See e.g this answer: http://stackoverflow.com/questions/2258932/embed-a-jre-in-a-windows-executable/2258946#2258946 – Jonik Apr 26 '10 at 10:54
-
Ah, I should've recommended exe4j by the same company instead: http://www.ej-technologies.com/products/exe4j/overview.html Not much difference from technical point of view (when it comes to making launchers), but it costs much less than install4j. – Jonik May 02 '10 at 13:11
The easiest way would be to include an unpacked Java installation on the CD and use it to run the application.
There are AFAIK only 2 "Java to exe" compilers still on the market, one of which (Excelsior JET) is quite expensive, and the other (GCJ) doesn't work on Programs that use AWT or Swing.

- 342,105
- 78
- 482
- 720
-
Also (at least) install4j does "Java to exe". To my knowledge it's the best of Java installer/launcher tools. – Jonik Apr 26 '10 at 10:59
-
1@Jonik: The software Michael Borgwardt was referring to are compilers, that create native code out of Java-Sources. install4j creates an exe-launcher for starting the Java-Bytecode with the proper JVM. That should be sufficient in most cases, but isn't really the "Java to exe" that Michael had in mind. – Mnementh Apr 26 '10 at 11:05
-
@Mnementh, ah, thanks for clarification. Looking at the original question, I don't think OP would need real "Java-to-native-code" though. – Jonik Apr 26 '10 at 11:11
-
@Jonik: What does it actually do? I couldn't tell from the worthless marketing BS on their homepage. An installer is not what's wanted here, nor a launcher that looks through the system for existing JREs. – Michael Borgwardt Apr 26 '10 at 11:14
-
Launcher **with bundled JRE**. (For example; this happens to be what OP needed.) See my comment in http://stackoverflow.com/questions/2712768/how-to-make-java-application-standalone/2712792#2712792. Their "features" page actually isn't marketing BS at all: http://www.ej-technologies.com/products/install4j/features.html (I've used this tool myself and know that it *is* good.) – Jonik Apr 26 '10 at 11:34
Here's one way... Bundle Java (the JRE) and Launch a Java App with 7zip SFX! ... (Convert Java Apps to an Executable, sort of)

- 22,080
- 4
- 63
- 85
Just burn a jre onto the cd as well and start your application inside a batch script, which sets the CLASSPATH and the JAVA_HOME variables pointing to your jre.

- 3
- 1