简体   繁体   English

使用 netbeans 为带有 DB 和第三方库的 Java 应用程序打包和分发 exe

[英]package and distribute exe for Java application with DB and third party lib using netbeans

I have create an application (in java swing ) using netbeans, There are a database connectivity using derby and more external jar file included in project.我已经使用 netbeans 创建了一个应用程序(在 java swing 中),有一个使用 derby 的数据库连接以及项目中包含的更多外部 jar 文件。

I want to create setup of java app我想创建 java 应用程序的设置

I followed these steps:我按照以下步骤操作:

  1. Create jar for project (Clean and build project from tools)为项目创建 jar(从工具清理和构建项目)

  2. Goto project and open dist folder, here is no DB folder so I copied DB folder (APPDATA) and paste it to dist folder.转到项目并打开 dist 文件夹,这里没有 DB 文件夹,所以我复制了 DB 文件夹(APPDATA)并将其粘贴到 dist 文件夹中。

  3. Now I create .exe from third party tools现在我从第三方工具创建 .exe

  4. When my Database folder places in same directory then exe run perfectly.当我的数据库文件夹放在同一目录中时,exe 运行完美。

But my question is how I can package .jar with APPDATA(Database folder) which can run reliably and independently in other systems as exe.但我的问题是如何将 .jar 与 APPDATA(数据库文件夹)打包,它可以在其他系统中作为 exe可靠且独立地运行

So I can able to make installer in future for same product.所以我将来可以为相同的产品制作安装程序

Only window exe creation and packaging solution is enough.只有window exe创建和打包解决方案就足够了。

You can use tools like Install Shield or NSIS for installation to build your exe which can open a zip file , extract and execute batch \\ shell scripts in which you can do whatever you want like installing your third party database & running your application jar.您可以使用 Install Shield 或 NSIS 等工具进行安装来构建您的 exe,该 exe 可以打开 zip 文件、提取和执行批处理 \\ shell 脚本,您可以在其中执行任何您想做的事情,例如安装第三方数据库和运行您的应用程序 jar。

I personally like NSIS as it is completely script based and open source .我个人喜欢NSIS,因为它完全基于脚本和开源。

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

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