简体   繁体   中英

adding files to a executable jar file

so i currently have a built version of my javafx apllication, and it resides within my dist folder. within the dist folder is a folder for my apache derby database, a folder for the external libraries I'm using and the executable jar file.

I'm wondering is it possible to have my database and external libraries within the executable jar instead of being in seperate folders, as i'm giving this application to customers and would prefer to have it in a single jar file instead of a zipped folder.

jar files are read only file so you can't put your database files in a jar file. You can use softwares like launch4j to create an exe of your jar and inno setup compiler to create a setup file of your application. So then you will be able to deliver it within a single file.

If the external libraries you are referring to are Java dependencies, and you are using Maven, you can package them into your program's Jar by using the Maven Shade Plugin . Then it is possible to programmatically create the folder where you will store the database during runtime, instead of sending an empty folder in the zipped folder.

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