简体   繁体   中英

packaging java application

我有一个Java应用程序,可从中构建一个依赖于许多第三方jar的jar,打包此应用程序以供最终用户分发的最佳/常见方式是什么?

The best way is to use a build tool like Maven2 or something similar, and use that to manage your dependencies and build a all-in-one package.

Otherwise, you'd mostly be stuck with messing with manifest files. Although, IDEs like Eclipse or NetBeans may help you a bit with that.

The way packaging is done. There are two ways

  1. wrap as executable: This is common, if you know the supportable platform and wrap the Jar in executable. And distribute it. Something like this http://launch4j.sourceforge.net/ (I have not used this, but there are similar wrapper available)

  2. Bundle all Jar and provide script: You can use Maven's Assembly plug-in to bundle everything in one Jar . With this done, you can distribute with a bat file and a .sh file for Windows and Linux based systems respectively. If you see Glassfish is distributed in similar manner. These scripts has executable command and, often take parameters for different behaviors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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