[英]Java application deploy
I have a Swing desktop application and have created a jar file which depends on library (which is kept in ./lib/
) and a .txt
file in the same folder. 我有一个Swing桌面应用程序,并创建了一个jar文件,它依赖于库(保存在./lib/
)和同一文件夹中的.txt
文件。 Now to execute the jar I have written a .bat
file which checks if Java is installed or not. 现在要执行jar,我编写了一个.bat
文件,用于检查是否安装了Java。 If installed then I run the jar file with command: 如果已安装,那么我使用命令运行jar文件:
javaw -jar TagEdit.jar
Now there are two problems I am facing with this: 现在我面临两个问题:
exe
. Java无处不在,并且有许多应用程序使用Java构建并打包在一个设置中,或者作为exe
。 I Googled a lot but could not find a way to create a setup for the software or an exe
. 我用Google搜索了很多但无法找到为软件或exe
创建设置的方法。 How are those software packaged? 这些软件是如何打包的? Have tried jlaunch, but could not get that to work correctly. 尝试了jlaunch,但无法让它正常工作。
Himz, Eclipse can automatically build a so-called "fat-jar" for you. Himz,Eclipse可以为你自动构建一个所谓的“胖罐”。 It is a jar that contains all the dependencies you need. 它是一个包含您需要的所有依赖项的jar。
If you are a happy Maven user, then you have two brilliant alternatives - the shade plugin, and the assembly plugin. 如果你是一个快乐的Maven用户,那么你有两个很棒的选择 - 树荫插件和组装插件。 They both can produce a "fat-jar" for you. 他们都可以为你制作一个“胖罐”。 :) :)
There are various answers to this. 对此有各种答案。
But I feel this isn't really the best way. 但我觉得这不是最好的方式。
If you don't want that 如果你不想那样
You could convert it to an executable. 您可以将其转换为可执行文件。 Try Googling java to exe . 尝试谷歌搜索java到exe 。
Once that is done, you could package it up as an installer using NSIS . 完成后,您可以使用NSIS将其打包为安装程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.