问题
In my project when i clicked the jar file it extracts embedded database files to near it self.
Is there any way to make them stay in the jar file?
回答1:
You can package a read-only Derby database into one of the jar files in your classpath, and access it using a different form of the connection URL. See: http://db.apache.org/derby/docs/10.8/devguide/cdevdvlp24155.html and http://db.apache.org/derby/docs/10.8/devguide/cdevdeploy11201.html#cdevdeploy11201
回答2:
Sure it's possible, you can put your DB image into any JAR's classpath and access it using:
Class.getResourceAsStream()
来源:https://stackoverflow.com/questions/7671026/is-there-any-way-to-save-embbeded-apache-derby-database-files-in-jar