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.
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.
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.
JSmooth can do the trick with bundling JRE or prompting install Java, and it is free. You can also set properties for JVM
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.
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.
来源:https://stackoverflow.com/questions/2712768/how-to-make-java-application-standalone