简体   繁体   English

如何制作一个exe文件

[英]how to make a swing as a exe file

I have java class in which I am doing some business functionality, now what I want is a standalone file so that user dont need to write java command to execute it but he can directly execute it as .exe file. 我有一个正在执行一些业务功能的Java类,现在我想要的是一个独立文件,因此用户无需编写Java命令即可执行它,但他可以将其直接作为.exe文件执行。 Can anybody help me in this? 有人可以帮我吗? I hope I was clear 我希望我很清楚

I would recommend to create a JAR file of your Java classes. 我建议创建您的Java类的JAR文件

JAR file can be executed with: java -jar filename.jar 可以使用以下命令执行JAR文件:java -jar filename.jar

For default installation in Windows, there will be a file association between JAR files and Java, such that one can double click on the jar file to execute it (ie, it behaves like an exe file). 对于Windows中的默认安装,JAR文件和Java之间将存在文件关联,因此可以双击jar文件来执行它(即,其行为类似于exe文件)。

First make a jar file and then wrap your jar file into .exe. 首先制作一个jar文件,然后将您的jar文件包装为.exe。 There are plenty softwares available. 有很多可用的软件。 Just google jar to exe 只是谷歌jar到exe

Have a look at launch4j . 看看launch4j It encapsulate a jar into a .exe. 它将jar封装到.exe中。

It has a lot of other useful functionalities such as checking for the correct JRE version or giving download links in case Java is not installed. 它还具有许多其他有用的功能,例如检查正确的JRE版本或在未安装Java的情况下提供下载链接。

简单地说,创建一个jar并在清单文件中放入您要运行的主类的入口点,请确保您的jar已使用JRE版本正确编译,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM