How to make Java with Applet project into .exe file. So it can run an any computer.
-
A Java applet would always require a Java runtime environment to run. So the Windows machine would need a JRE installed, and it would also have to allow applets to run. – Tim Biegeleisen Jan 13 '18 at 06:12
1 Answers
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.

- 698,415
- 94
- 811
- 1,216
-
Lots of ways. What do you use to build your Java code? (And I am not your "bro"!) – Stephen C Jan 13 '18 at 06:51
-
-
That doesn't answer my question. But **assuming** that you are using the JDK command line tools (rather than an IDE or a build tool), the `jar` command is the one you should use to build a JAR file. Read the manual entry for it. – Stephen C Jan 13 '18 at 07:29