在没有安装JRE的情况下,在Windows中运行java程序作为exe。

时间:2022-08-31 20:47:13

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

我想在Windows中作为exe运行一个java程序。windows系统根本不安装java…

So, is there any other way in which the java program can be converted to an exe which removes the need for a dependency on the JRE?

那么,有没有其他方法可以将java程序转换为exe,从而消除对JRE的依赖关系?

8 个解决方案

#1


7  

You can use Excelsior JET compiler for that purpose.

您可以为此目的使用Excelsior JET编译器。

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

更多信息请参见http://www.excelsiorjet.com/。

#2


6  

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.

您可以将JRE与应用程序一起交付,并将该JRE用于应用程序。其效果是相同的:应用程序将通过可执行文件(需要)或脚本(批处理)文件启动,目标机器不需要安装java运行时。

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

Java不必“安装”,只需“呈现”即可。

#3


2  

Jexepack

Jexepack

#4


1  

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.

要让应用程序运行,需要运行运行时。实际上,当你启动应用程序的时候,首先会发生的事情是调用操作系统来启动JRE。没有JRE不行。

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

当然,如果你想的话,你可以把JRE添加到你的app中。

#5


1  

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

GCJ可以从Java源文件中创建本机代码。下面是如何在Windows中构建它的教程。

#6


1  

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

我使用JSmooth来显示我的应用。它还允许在内部嵌入一个JRE。我只是使用了“确保至少Java X是可用的”。

GPL, can be run as an ant task.

GPL,可以作为ant任务运行。

#7


0  

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.

你有试过install4j吗?这个概念有各种各样的版本,有些是免费的。基本上,这个应用程序将您的应用程序编译成可执行的安装程序,具体到您所选择的操作系统。

#8


0  

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

鉴于您正在Windows中请求一个可执行文件(exe),还有另一种方法:

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

IKVM使用。NET -字节码编译器,它将Java字节码转换为。NET dll和exe。

Get the latest version of IKVM.NET here.

获取最新版本的IKVM。净。

Use this command

使用此命令

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

to create your .NET executable file.

创建。net可执行文件。

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:

之后,您可以使用您的exe与强制性的IKVM dll的或如果您喜欢一个exe文件,您可以使用ILMerge以获得一个可执行文件:

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

#1


7  

You can use Excelsior JET compiler for that purpose.

您可以为此目的使用Excelsior JET编译器。

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

更多信息请参见http://www.excelsiorjet.com/。

#2


6  

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.

您可以将JRE与应用程序一起交付,并将该JRE用于应用程序。其效果是相同的:应用程序将通过可执行文件(需要)或脚本(批处理)文件启动,目标机器不需要安装java运行时。

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

Java不必“安装”,只需“呈现”即可。

#3


2  

Jexepack

Jexepack

#4


1  

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.

要让应用程序运行,需要运行运行时。实际上,当你启动应用程序的时候,首先会发生的事情是调用操作系统来启动JRE。没有JRE不行。

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

当然,如果你想的话,你可以把JRE添加到你的app中。

#5


1  

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

GCJ可以从Java源文件中创建本机代码。下面是如何在Windows中构建它的教程。

#6


1  

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

我使用JSmooth来显示我的应用。它还允许在内部嵌入一个JRE。我只是使用了“确保至少Java X是可用的”。

GPL, can be run as an ant task.

GPL,可以作为ant任务运行。

#7


0  

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.

你有试过install4j吗?这个概念有各种各样的版本,有些是免费的。基本上,这个应用程序将您的应用程序编译成可执行的安装程序,具体到您所选择的操作系统。

#8


0  

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

鉴于您正在Windows中请求一个可执行文件(exe),还有另一种方法:

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

IKVM使用。NET -字节码编译器,它将Java字节码转换为。NET dll和exe。

Get the latest version of IKVM.NET here.

获取最新版本的IKVM。净。

Use this command

使用此命令

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

to create your .NET executable file.

创建。net可执行文件。

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:

之后,您可以使用您的exe与强制性的IKVM dll的或如果您喜欢一个exe文件,您可以使用ILMerge以获得一个可执行文件:

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