Search code examples
javaapplet

How to make Java with Applet project into .exe file


How to make Java with Applet project into .exe file. So it can run an any computer.


Solution

  • It is not possible.

    It is not possible to create an exe that will run on any computer. Period.

    It is possible to create an exe that will run on a Windows machine (I hesitate to say any Windows) but that exe won't run on Linux or Mac OSX ... or any machine that is not a x86 or x86-64 machine (depending on how you built the exe).

    It is possible to run a Java application (from a JAR file) on any machine with Java preinstalled.

    It is possible to create an exe wrapper for a Java application (see How can I convert my Java program to an .exe file?), but the exe won't that can run on any machine. Like all exe files, it will only run on specific operating systems / hardware architectures. And converting to an exe like this may cause some aspects of Java not to work.

    I would recommend these alternatives:

    • Distribute your application as a JAR file, and leave it up to the user to download and install a JRE separately. (That is NOT hard to do.)

    • Use an installer-builder (such as InstallAnywhere) to create installers for your application for the platforms you want to support. Use the option for embedding a JRE in the installer.


    The other issue is that applet support is going to be removed entirely from Java pretty soon. Indeed, it has already been de-supported in most modern browsers. You should be looking to rewrite your UI code using AWT / Swing, JavaFX, HTML5 or something else.