db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fran├žois <francois.rap...@unifr.ch>
Subject Database in a jar starts from another dir
Date Fri, 06 Nov 2009 09:40:09 GMT
Hi
I have java classes and a database within the same jar. Using the connection
string jdbc:derby:jar:(myfile.jar)mydatabase (now defined at comiled time) all
works well if I start the application by double-clicking the jar or running the
jar with java -jar myapp.jar in the directory where myfile.jar and derby.jar 
are. In the manifest of the jar I have a class-path attribute with derby.jar.

Now if I have a shortcut to the jar or in I run the apps from another directory
the database is lost. For example, running 
java -cp u:\docs ..\myfile.jar ch.my.package.MyMainClass does not resolve the
problem.
I could put a properties file with the connection string with the full path to
the jar file in the connection string, but I would ask if there is another 
solution.

Thanks for any help

Fran├žois


Mime
View raw message