Running a java program as an exe in Windows without JRE installed

Solution 1:

You can use Excelsior JET compiler for that purpose.

See http://www.excelsiorjet.com/ for more information on this.

Solution 2:

You can ship the JRE with your application and use that JRE for your application. The effect is the same: The application will be started through an executable (wrapper needed) or script (batch) file and the target machine does not need to have a java runtime installed.

Java doesn't have to be 'installed', it just has to be 'present'.

Solution 3:

For the application to run you will need the runtime. In fact the very first thing that happens when you start the app is a call is a made to OS to start JRE. You cannot do without JRE.

[You can of course embded JRE into your app itself if you want].

Solution 4:

I have used JSmooth to exify my application. It also allows for embedding a JRE inside. I just used the "ensure that at least Java X is available".

GPL, can be run as an ant task.

Solution 5:

Well given the fact, that you are requesting an executable file (exe) in Windows, there is another approach:

Use IKVM.NET - Bytecode Compiler which converts Java bytecode to .NET dll's and exe's.

Get the latest version of IKVM.NET here.

Use this command

 ikvmc -target:exe -out:foo.exe yourJarFile.jar

to create your .NET executable file.

After this, you can use your exe with the mandatory IKVM dll's or if you prefer one exe file, you can use ILMerge in order to get a single executable file:

ILMerge.exe /target:winexe /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1" /out:C:\foo\bar.exe foo.exe <IKVM dll's>.dll