Re: How to Combine Apache Derby without installing with Jar Directly

2015-01-08 Thread Peter Ondruška
You can use Eclipse to create runnable jar that packs other jars inside.

On Wednesday, 7 January 2015, Varun Sawaji sawaji.va...@gmail.com 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



-- 
Peter Ondruška


How to Combine Apache Derby without installing with Jar Directly

2015-01-07 Thread Varun Sawaji
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


Re: How to Combine Apache Derby without installing with Jar Directly

2015-01-07 Thread Rick Hillegas

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


Re: How to Combine Apache Derby without installing with Jar Directly

2015-01-07 Thread John English

On 07/01/2015 09:09, 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.


Just unjar derby.jar and include the result with your own classes in a new jar.
(Really annoying that nested jars aren't possible!)

For the DB itself, you'll need to either have a setup class that processes a 
bunch of DDL statements to create and initialise the DB tables, or which unzips 
a pre-created DB from a zip file inside the jar to a directory on the user's system.

--
John English