简体   繁体   中英

Java - properties file on dist folder

This is my src package:

/src/PropertyAccess.java

/src/config.properties

The config.properties is added to the classpath and is in the Project.jar.

But I want it to be in my dist folder so, whenever my java application needs to be distributed, the user can configure its own properties.

I need to have this structure in my dist folder: /dist/Project.jar /dist/config/config.properties.

And my jar needs to load the properties from the dist/config.properties file.

How can this be done?

Edit the "-post-compile" target inside the build.xml as follows:

<target name="-post-compile">
    <copy file="textfile.txt" todir="${dist.dir}"/>        
</target>

You can place any .properties etc file instead of .txt

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