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

前端 未结 7 851
悲&欢浪女
悲&欢浪女 2020-11-28 13:55

I want to run a java program as an exe in Windows. The windows box doesn\'t install java at all...

So, is there any other way in which the java program can be conve

相关标签:
7条回答
  • 2020-11-28 14:02

    Have you tried install4j? There are various versions, some free, of this concept. Basically, this application compiles your application into an executable installer, specific to the OS of your choice.

    0 讨论(0)
  • 2020-11-28 14:04

    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'.

    0 讨论(0)
  • 2020-11-28 14:07

    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].

    0 讨论(0)
  • 2020-11-28 14:09

    GCJ can create native code from Java source files. Here's a tutorial on how to build it in Windows.

    0 讨论(0)
  • 2020-11-28 14:10

    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
    
    0 讨论(0)
  • 2020-11-28 14:11

    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.

    0 讨论(0)
提交回复
热议问题