Обсуждение: "static" libraries?

Поиск
Список
Период
Сортировка

"static" libraries?

От
Jeffrey Napolitano
Дата:
I have a Java application which uses JDBC, and it is going to put on a
few different machines using postgres and postgres's JDBC driver.  My
question is this:  Is there a method of *including* the JDBC driver into
the Java application?  An equivalent to statically linking a library in
C?

The CLASSPATH is going to be different on different machines, and I need
a way of just depositing this one file onto a system.

--
When I was seven years old, I was once reprimanded by my mother for an
act of collective brutality in which I had been involved at school.  A
group of seven-year-olds had been teasing and tormenting a
six-year-old.  "It is always so," my mother said.  "You do things
together which not one of you would think of doing alone."  ...
Wherever one looks in the world of human organization, collective
responsibility brings a lowering of moral standards.  The military
establishment is an extreme case, an organization which seems to have
been expressly designed to make it possible for people to do things
together which nobody in his right mind would do alone.
                -- Freeman Dyson, "Weapons and Hope"

Jeffrey Napolitano
Lowly Intern
Software Emancipation Technology

Re: [INTERFACES] "static" libraries?

От
Dallas Hockley
Дата:
Jeffrey Napolitano wrote:
>
> I have a Java application which uses JDBC, and it is going to put on a
> few different machines using postgres and postgres's JDBC driver.  My
> question is this:  Is there a method of *including* the JDBC driver into
> the Java application?  An equivalent to statically linking a library in


This can be done by "unjarring" the postgresql jdbc driver jar in the
base class directory of your app/let and then jar'ring the entire
distribution into one file.  The relative class resolution must be
correct, and it will work....

Good Luck.

Dallas

Dallas Hockley
hockleyd@cybersoft.ab.ca

Re: [INTERFACES] "static" libraries?

От
Peter T Mount
Дата:
[email problems within maidstone.gov.uk has delayed this response -
peter]

On Thu, 16 Jul 1998, Dallas Hockley wrote:

> Jeffrey Napolitano wrote:
> >
> > I have a Java application which uses JDBC, and it is going to put on a
> > few different machines using postgres and postgres's JDBC driver.  My
> > question is this:  Is there a method of *including* the JDBC driver into
> > the Java application?  An equivalent to statically linking a library in
>
>
> This can be done by "unjarring" the postgresql jdbc driver jar in the
> base class directory of your app/let and then jar'ring the entire
> distribution into one file.  The relative class resolution must be
> correct, and it will work....

It will work that way.

The down side to this is that if a newer version of the driver is
released, then you have to rebuild your application jar file.

--
Peter Mount (at work) peter@taer.maidstone.gov.uk or peter@maidstone.gov.uk
If you mail me here, please cc my home address peter@retep.org.uk



Re: [INTERFACES] "static" libraries?

От
Jeffrey Napolitano
Дата:
And the application (let's say java_app.jar) can be invoked directly by
name?

i.e.:

/usr/local/bin/java_app.jar

?

Thanx
>
> [email problems within maidstone.gov.uk has delayed this response -
> peter]
>
> On Thu, 16 Jul 1998, Dallas Hockley wrote:
>
> > Jeffrey Napolitano wrote:
> > >
> > > I have a Java application which uses JDBC, and it is going to put on a
> > > few different machines using postgres and postgres's JDBC driver.  My
> > > question is this:  Is there a method of *including* the JDBC driver into
> > > the Java application?  An equivalent to statically linking a library in
> >
> >
> > This can be done by "unjarring" the postgresql jdbc driver jar in the
> > base class directory of your app/let and then jar'ring the entire
> > distribution into one file.  The relative class resolution must be
> > correct, and it will work....
>
> It will work that way.
>
> The down side to this is that if a newer version of the driver is
> released, then you have to rebuild your application jar file.
>
> --
> Peter Mount (at work) peter@taer.maidstone.gov.uk or peter@maidstone.gov.uk
> If you mail me here, please cc my home address peter@retep.org.uk
-------------------
Jeffrey Napolitano
Lowly Intern
Software Emancipation Technology

Re: [INTERFACES] "static" libraries?

От
Peter T Mount
Дата:
On Tue, 21 Jul 1998, Jeffrey Napolitano wrote:

> And the application (let's say java_app.jar) can be invoked directly by
> name?
>
> i.e.:
>
> /usr/local/bin/java_app.jar

No, that will not work. jar files are simply plain uncompressed zip files,
and are not executable. The way around this is to write a wrapper script,
that invokes java with the jar file.

The jdk utilities including javac and java are done in this way.

> > [email problems within maidstone.gov.uk has delayed this response -
> > peter]
> >
> > On Thu, 16 Jul 1998, Dallas Hockley wrote:
> >
> > > Jeffrey Napolitano wrote:
> > > >
> > > > I have a Java application which uses JDBC, and it is going to put on a
> > > > few different machines using postgres and postgres's JDBC driver.  My
> > > > question is this:  Is there a method of *including* the JDBC driver into
> > > > the Java application?  An equivalent to statically linking a library in
> > >
> > >
> > > This can be done by "unjarring" the postgresql jdbc driver jar in the
> > > base class directory of your app/let and then jar'ring the entire
> > > distribution into one file.  The relative class resolution must be
> > > correct, and it will work....
> >
> > It will work that way.
> >
> > The down side to this is that if a newer version of the driver is
> > released, then you have to rebuild your application jar file.
> >
> > --
> > Peter Mount (at work) peter@taer.maidstone.gov.uk or peter@maidstone.gov.uk
> > If you mail me here, please cc my home address peter@retep.org.uk
> -------------------
> Jeffrey Napolitano
> Lowly Intern
> Software Emancipation Technology
>

--
Peter Mount (at work) peter@taer.maidstone.gov.uk or peter@maidstone.gov.uk
If you mail me here, please cc my home address peter@retep.org.uk



Re: [INTERFACES] "static" libraries?

От
Dallas Hockley
Дата:
Peter T Mount wrote:
>
> On Tue, 21 Jul 1998, Jeffrey Napolitano wrote:

[BIG snip]

> > > The down side to this is that if a newer version of the driver is
> > > released, then you have to rebuild your application jar file.
> > >

There is another method that _may_ work, YMMV, as I haven't tried it in
this contect myself.  There is a URL class loader, which can in essence
load the driver class from a jar file referenced by a URL and served up
by a web server on the network.  It's not unlike loading the Driver
class locally, and you can then have a central distribution point (or
points) for the driver.

Just an idea...

Dallas Hockley
hockleyd@cybersoft.ab.ca