Netbeans的爪哇(JavaFX的)本地程序包与其他文件和文件夹 [英] Netbeans Java (JavaFX) Native Packaging with additional files and folders
问题描述
如何包括其他文件和文件夹(配置文件)时,本机打包的Java应用程序?
How to include additional files and folders (configuration files) when natively packaging Java applications?
在建项目,我已经附加文件设置生成的文件创建目录并复制到dist目录。
When building the project, I have set the build file to create directories and copy additional files to the dist directory.
我建立正常(无本地包装)将导致到这个目录结构:
My normal builds (without native packaging) would result to this directory structure:
-> dist
-> lib
-> application.jar
-> config folder //additional folder
-> another additional folder //additional folder
现在,我想建有这些addtional文件夹/我的应用程序和运行时一起提取的文件我的本机安装程序(设置)。
Now, I would like to build my native installer (setup) having those addtional folders/files extracted together with my application and runtime.
基本上当我的本地安装程序运行,它会创建以下文件:
Basically when my native installer is ran, it will create these files:
-> app
-> lib
-> application.jar
-> package.cfg
-> runtime
-> jre
-> applcation.exe
-> application.ico
-> unins000.dat
-> unins000.exe
我的其他文件和文件夹将不包括在我的安装程序。我想有我的安装程序与其他文件中提取,preferably这样
My additional files and folders are not included in my installer. I would like to have my installer with those additional files extracted, preferably like this
-> app
-> lib
-> config folder //additional folder
-> another additional folder //additional folder
-> application.jar
-> package.cfg
-> runtime
-> jre
-> applcation.exe
-> application.ico
-> unins000.dat
-> unins000.exe
顺便说一句,我使用了原生包装Ant构建工具和应用创新。
By the way, I am using Ant Build tool and Inno for native packaging.
推荐答案
我只有史以来本地软件包与维克斯
,所以我立足于对我的回答知识我从那段经历。一个目标添加到蚂蚁
构建脚本,并创建一个 FX:部署
任务。将 nativeBundles
属性EXE。文件集 S到 FX:应用程序/ FX:资源
XPATH可以通过添加外汇指定其他文件和文件夹。它可能看起来像这样。
I've only ever built native packages with Wix
, so I'm basing my answer on the knowledge I have from that experience. Add a target to your Ant
build script and create an fx:deploy
task. Set the nativeBundles
attribute to exe. You can specify additional files and folders by adding fx:fileset
s to the fx:application/fx:resources
XPATH. It might looking something like this.
<target name="deploy">
<fx:deploy verbose="true" nativeBundles="exe" ...>
<fx:application name="${app.title}" mainClass="${main.class}" version="${version}">
<fx:resources>
<fx:fileset dir="${base.dir}" includes="config/*.*" />
<fx:fileset dir="${base.dir}" includes="data/*.*" />
</fx:resources>
</fx:application>
</fx:deploy>
</target>
有很多更可以在外汇指定:资源
部分。有在Oracle教程更详细的信息,特别是第6节。
There is a lot more you can specify in the fx:resources
section. There's more detailed information in the Oracle tutorials, particularly Section 6.
这篇关于Netbeans的爪哇(JavaFX的)本地程序包与其他文件和文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!