Netbeans和外部配置文件 [英] Netbeans and external configuration files

查看:136
本文介绍了Netbeans和外部配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Java桌面应用程序,并且想要一个外部configuration.xml.
我正在使用Netbeans开发应用程序,并尝试在dist目录中添加configuration.xml文件,以便它位于应用程序工作文件夹中.但是,当Netbeans执行其清理操作时,它将删除dist目录,
我应该把这个configuration.xml文件放在哪里,以便它不会被删除并存在于应用程序启动目录中.

I am developing a Java desktop application and would like to have an external configuration.xml.
I am developing the application using Netbeans and tried to add the configuration.xml file in the dist directory so that it resides in the application work folder. But when Netbeans executes its clean operation it deletes the dist directory,
Where should I put this configuration.xml file so that it will not be deleted and will exist in the application start-up directory.

推荐答案

您可以将其添加到build.xml中:

You can add this to your build.xml :

<target name="-post-jar">
   <copy todir="${dist.jar.dir}">
       <fileset dir="resources" includes="**"/>
   </copy>        
</target>

现在,您可以将configuration.xml文件放在项目中的资源"文件夹(需要创建)中,并且其中的所有文件都将在构建过程中复制到dist文件夹中.

You can now put your configuration.xml file in the folder 'resources' (that you need to create) in your project and all files in it will be copied to the dist folder during the build process.

这篇关于Netbeans和外部配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆