On 1/6/15 11:09 PM, Varun Sawaji wrote:
Hi,

I have application which was developed using Java and Apache Derby. I want to create executable JAR and run on any system which doesnot have derby DB.When I click on Jar file the derby also install on the system. Is it possible.

Varun
Hi Varun,

A common solution to this problem is to put your application in a zip file which has the following shape:

1) a top level directory containing your application jar file.

2) a subdirectory (called, say "lib") which contains all of the 3rd party jar files needed by your application.

3) the manifest in your application jar file should contain a Class-Path declaration which wires together all of the 3rd party jar files needed by your application.

Installing the application consists of unzipping the zip file. Running the application consists of clicking on the application jar file.

If you pursue the approach of unpacking the 3rd party jar files and then jar'ing up the result together with your application classes, then be aware of the following problems:

i) All of your classes are now in the same security codebase. This will make it harder for you to grant specific permissions to your application and specific permissions to your 3rd party libraries.

ii) If any of your 3rd party jar files contain services (like the JDBC drivers in derby.jar and derbyclient.jar), then your META-INF manifest directory will need to contain a file called "services", which contains the names of all of those services. Otherwise, autoloading of services (including autoloading of the Derby JDBC drivers) will not work.

Hope this helps,
-Rick

Reply via email to