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.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Correct code...
Add this in the main build.xml (not nbproject\build-impl.xml). You may also replace "-pre-jar" with "-post-jar"
You can add this to your build.xml :
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.
I was able to get this to work, but I couldn't get -post-jar to trigger without explicitly entering it as a dependency in the main build config. This is in Netbeans 7.0.1 for a Rich Client project.
Instead, in build.xml for the Netbeans module where I want to have external resource files (mainly .txt files that the user could potentially edit later), I entered the following:
Then I create a new directory in my module's top directory (right alongside src, release, build) called 'resources' and place my .txt files in there.
When you do a build on this module, netbeans-extra will get called as a dependency and carry out the creation of a 'resources' folder in the main project build/cluster directory, followed by copying the contents of the project resources directory over there.
Ultimately, when you build a distribution for your project, you'll find the resource directory placed right next to your projects modules directory, making for a nice and neat side by side arrangement.