如何从我的 java 项目生成 exe 文件?我应该使用哪个工具?

发布于 2024-08-21 14:58:46 字数 148 浏览 8 评论 0原文

有人要求我制作一个程序(用java),但我被困住了,因为我不知道如何从我的jar文件生成exe文件......如果我为他们安装jdk环境,那将是无用的这个人不会如何编程...有谁知道如何做到这一点或者我应该使用什么工具?

来自阿根廷科尔多瓦首都的问候...提前致谢!

I was asked to make a program (in java) by some person but I was stacked as I didn't know how to generate and exe file from my jar file... It would be useless If I install for them the jdk environment as this person don't how to program... Does anyone knows ho to do this or what tool should I use ?

Regards from Córdoba Capital, Argentina...Thanks in advance !!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

盗心人 2024-08-28 14:58:46

您可以使用 launch4J,它的使用和配置非常简单。

You could use launch4J, it's pretty simple to use and to configure.

等往事风中吹 2024-08-28 14:58:46

这是之前的一篇文章,其中有一些其他选项:
如何创建 Java 应用程序单击即可运行?

正如 Lucas 上面提到的,您需要在用户的计算机上安装 JRE 才能使 Java 应用程序正常运行。如果它是一个小程序,您可以考虑制作一个.bat文件(或*nux上的.sh文件)以允许用户运行该程序。您的 bat 文件可以像下面的文件一样简单。只需放入 .bat 文件并添加为快捷方式即可。我知道有更优雅的解决方案,但这很简单并且应该可行。

setlocal
set CP=<PATH TO ANY DEPENDENT LIBRARIES OR JARS>
start javaw -cp %CP% <FULLY QUALIFIED MAIN METHOD> <PROGRAM PROPERTIES>
endlocal

Here is a post from earlier that has some other options:
How to create a Java application which can be run by a click?

As Lucas mentions above, you will need to install the JRE on the user's machine to get a Java app to run properly. If it is a small program, you could consider making a .bat file (or .sh file on *nux) to allow the user to run the program. Your bat file could as simple as the one below. Just put in a .bat file and add as a short cut. I know there are more elegant solutions out there, but this is simple and should work.

setlocal
set CP=<PATH TO ANY DEPENDENT LIBRARIES OR JARS>
start javaw -cp %CP% <FULLY QUALIFIED MAIN METHOD> <PROGRAM PROPERTIES>
endlocal
薄情伤 2024-08-28 14:58:46

他们不需要安装整个 JDK 来运行 jar 文件,他们所需要的只是明显较小的 JRE。这是分发 Java 应用程序时的标准做法。

与生成本机二进制文件相比,在 jvm 上运行 java 程序的一大优点是,假设您没有使用依赖于平台的库,它会立即独立于平台。

They don't need to install the entire JDK to run the jar file, all they need is the significantly smaller JRE. This is standard practice when distributing java applications.

A big advantage of running your java program on the jvm as compared to generating a native binary is that it will, assuming you aren't using a platform-dependent library, be platform-independent straight away.

━╋う一瞬間旳綻放 2024-08-28 14:58:46

您可以使用Excelsior JET。它不是免费的,工作速度很慢,但您可以创建可执行文件(非常大的可执行文件)。我在 Windows 上测试了它并且有效。但它创建的可执行文件比使用 JRE 运行 .jar 慢。

还有 GCJ。我尝试过,但是编译我的项目对我来说太难了。

我建议安装 JRE 并使用 .jar 文件。

You can use Excelsior JET. It is not free, work quite slow, but you can create executable (very huge executable). I tested it on Windows and it worked. But executable it created was slower then .jar run using JRE.

There is also GCJ. I tried it, but it was too hard for me to compile my project.

I suggest installing JRE and working with .jar file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文