简体   繁体   English

可运行的jar或bat文件,用于执行Java桌面应用程序

[英]Runnable jar or bat file for executing java Desktop applications

As I know there are two standard ways you can distribute a Java desktop application: 据我所知,可以通过两种标准方式分发Java桌面应用程序:

  1. Through a runnable jar file 通过可运行的jar文件
  2. Through a bat file which calls a jar file to begin execution 通过蝙蝠文件调用jar文件开始执行

I want to know what is the best way among these methods and what are the relative advantages and disadvantages? 我想知道这些方法中最好的方法是什么,相对的优缺点是什么?

The list is missing the best one! 该列表缺少最佳列表!

  1. .. ..
  2. .. ..
  3. Java Web Start . Java Web Start

Java Web Start (JWS) is the Oracle Corporation technology used to launch rich client (Swing, AWT, SWT) desktop applications directly from a network or internet link. Java Web Start(JWS)是Oracle Corporation的技术,用于直接从网络或Internet链接启动富客户端(Swing,AWT,SWT) 桌面应用程序 It offers 'one click' installation for platforms that support Java. 它为支持Java的平台提供“一键式”安装。

JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions.. JWS提供了许多吸引人的功能,包括但不限于初始屏幕,桌面集成,文件关联,自动更新(包括延迟下载和更新的程序控制),按平台,体系结构或Java版本,配置对本机和其他资源下载进行分区运行时环境(最低J2SE版本,运行时选项,RAM等),使用扩展轻松管理公共资源。

In case it is not clear, I vote JWS as the 'best' from a user point of view. 如果不清楚,我从用户角度将JWS评为“最佳”。 The details of the advantages are pretty much expressed in the 2nd paragraph of the description, but also the last sentence of the first. 优点的细节在说明的第二段中也有很多表达,但在第一段的最后一句中也有表达。 Not to forget the 1st sentence of the next paragraph.. 不要忘记下一段的第一句。

By default, an applet-like security sand-box is applied to code launched using JWS. 默认情况下,类似于applet的安全沙箱将应用于使用JWS启动的代码。 .. ..

I think runnable jar would be a good option for desktop application. 我认为可运行的jar将是桌面应用程序的不错选择。 As I am using it for my desktop application is more comfortable and user friendly. 当我将其用于我的桌面应用程序时,它更加舒适和用户友好。

I think it will depend on who are the users of your application. 我认为这将取决于谁是您的应用程序的用户。 If the users are non-tech people you better go with a runnable jar because they are less likely to pass an argument to your program. 如果用户是非技术人员,则最好使用可运行的jar,因为它们不太可能将参数传递给您的程序。

In case they are your team members or other tech people, you may give them a .bat to play around with your app. 如果他们是您的团队成员或其他技术人员,则可以给他们一个.bat来使用您的应用程序。

对于Windows,可以考虑使用类似Launch4j的包装器。

开源软件总是使用.bat或.sh文件来分发Java应用程序。我认为这种方式是一个不错的选择。

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

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