You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Krebs <tk...@attglobal.net> on 2000/03/17 20:47:55 UTC

jar files in classpath

Although I set my classpath to the cocoon.jar, cocoon does only startup if I extract the files into the classes directory of the context for cocoon. 
Any ideas?

cheers,
thomas

Re: jar files in classpath

Posted by Stefano Mazzocchi <st...@apache.org>.
Charles Yates wrote:
> 
> A very useful way to do this is to put any jar files you use frequently
> into $JAVA_HOME/jre/lib/ext.  They are then automatically in the
> classpath without having to specify on the command line or in any
> configuration files.

This is _NOT_ a good way of handling your classpath for a few
non-trivial reasons:

1) you loose contact with your classpath. Since the ext directory is
host-wise and not user-local, every user is affected by this choice.
Suppose you want to run Cocoon 1.6 and Cocoon 1.7 and Cocoon 2.0 on the
same machine for different users, that way you loose the ability to do
that.

2) sometimes jars contain the same interfaces with different versions.
For example, xerces.jar and xml.jar both include the DOM API, but while
xerces is DOM2, projectx has DOM1. Writing your classpath by hand
(either in your jserv.properties or in your startup script), allows you
to put xerces.jar in front and forget about compatibility problems.

3) ext is provided for global extentions. A better way of achieving the
same functionality is to add -bootclasspath with the library that
contains the jars (say cocoon/lib), but doing that you loose the ability
to force the order of jars, thing that might be necessary in some
modular environments like Cocoon.

To be honest, I've used JDK 1.2 over 1.1 because of ext-capabilities...
but now, after hours of trouble, I understand that is far less expensive
to write a nice and simple batch/shell script instead of having those
problems with classpaths later on.

Hey, do as you like, but you've been warned :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



RE: jar files in classpath

Posted by JJD <jj...@home.com>.
Thank you for the explanations. Definitely helpful. JJD

-----Original Message-----
From: Stefano Mazzocchi [mailto:stefano@apache.org]
Sent: Monday, March 20, 2000 9:51 AM
To: cocoon-users@xml.apache.org
Subject: Re: jar files in classpath


JJD wrote:
>
> Hi: This is interesting, because I always had a hard time understanding
the
> issue of classpath. Can you elaborate why/how $JAVA_HOME/jre/lib/ext
works?
> Thanks in advance for any info. JJD

"ext" was added to Java 1.2 to allow easy installation of standard
platform extentions. These are usually jar files (+ eventual native
libraries) that are required  in case you need standard extentions.

Examples of those extentions are:
 - java3d...

Hope this helps.

--
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: jar files in classpath

Posted by Stefano Mazzocchi <st...@apache.org>.
JJD wrote:
> 
> Hi: This is interesting, because I always had a hard time understanding the
> issue of classpath. Can you elaborate why/how $JAVA_HOME/jre/lib/ext works?
> Thanks in advance for any info. JJD

"ext" was added to Java 1.2 to allow easy installation of standard
platform extentions. These are usually jar files (+ eventual native
libraries) that are required  in case you need standard extentions.

Examples of those extentions are:
 - java3d
 - servlets
 - jndi
 - jti
 - jmi
 - jai
 - and so on..

the $JAVA_HOME/jre/lib/ext is usually referred to as the
"bootclasspath". In java 1.2 "java" executable there is a now
"-bootclasspath" flag that can change the location of such
bootclasspath. So, for example, if you consider "xerces.jar" and
"xalan.jar" extentions to your environment, you could run cocoon from
the command line as

 java -bootclasspath ./lib org.apache.cocoon.Cocoon

instead of copying them inside the $JAVA_HOME/jre/lib/ext directory,
thus influencing every other program (that may get in conflicts with
your added libraries).

So, as a general rule, libraries are not extentions. Extentions are
those things that are required by all and change their interfaces very
rarely. So, for example, while DOM, SAX, JAXP and TRaX are extentions,
xalan and xerces are not (they implement those interfaces).

Also, the bootclasspath is always loaded _before_ your classpath and the
standard java classloader loads a class with the required name as the
_first_ occurrence of that class. So if you have a DOM1 interface in
your extentions and want to use DOM2 included in your classpath, you
simply can't!

So, site-wise, it's a good practice to place interfaces and APIs inside
the extentions directory and never place interface implementations, or,
even worse, java applications.

Please note that Sun fully understands how difficult it is to install a
java application in a system. For this reason, it was created a proposal
for the creation of a standard way to install and deploy both
extentions, libraries and applications. This is currently discussed
inside the JCP, but I know nothing else about (read the JCP site for
more info on this).

Hope this helps.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re: jar files in classpath

Posted by Charles Yates <ce...@attglobal.net>.
Check out http://java.sun.com/docs/books/tutorial/ext/index.html

Also check out Stefano's reply as to why it may not be such a good
idea to do this with Cocoon.

I find it a useful way of eliminating the need to type (and misspell)
long classpaths in the command line.

Charles



JJD wrote:

> Hi: This is interesting, because I always had a hard time understanding the
> issue of classpath. Can you elaborate why/how $JAVA_HOME/jre/lib/ext works?
> Thanks in advance for any info. JJD
>
> -----Original Message-----
> From: charles@mx4-e.mail.home.com [mailto:charles@mx4-e.mail.home.com]On
> Behalf Of Charles Yates
> Sent: Monday, March 20, 2000 3:38 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: jar files in classpath
>
> A very useful way to do this is to put any jar files you use frequently
> into $JAVA_HOME/jre/lib/ext.  They are then automatically in the
> classpath without having to specify on the command line or in any
> configuration files.
>
> Carel-J Rischmuller wrote:
>
> > Do you specifically specify the jar file in the classpath, or do you just
> > set
> > the path of where the jar file lies?
> > i.e.    CLASSPATH=/lib/cocoon/cocoon.jar
> > instead of
> >          CLASSPATH=/lib/cocoon/
> >
> > The first one is the correct one.
> >
> > Cheerio
> > Carel-J
> >
> > Thomas Krebs wrote:
> >
> > > Although I set my classpath to the cocoon.jar, cocoon does only startup
> > > if I extract the files into the classes directory of the context for
> > > cocoon.
> > > Any ideas?
> > >
> > > cheers,
> > > thomas
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


RE: jar files in classpath

Posted by JJD <jj...@home.com>.
Hi: This is interesting, because I always had a hard time understanding the
issue of classpath. Can you elaborate why/how $JAVA_HOME/jre/lib/ext works?
Thanks in advance for any info. JJD

-----Original Message-----
From: charles@mx4-e.mail.home.com [mailto:charles@mx4-e.mail.home.com]On
Behalf Of Charles Yates
Sent: Monday, March 20, 2000 3:38 AM
To: cocoon-users@xml.apache.org
Subject: Re: jar files in classpath


A very useful way to do this is to put any jar files you use frequently
into $JAVA_HOME/jre/lib/ext.  They are then automatically in the
classpath without having to specify on the command line or in any
configuration files.

Carel-J Rischmuller wrote:

> Do you specifically specify the jar file in the classpath, or do you just
> set
> the path of where the jar file lies?
> i.e.    CLASSPATH=/lib/cocoon/cocoon.jar
> instead of
>          CLASSPATH=/lib/cocoon/
>
> The first one is the correct one.
>
> Cheerio
> Carel-J
>
> Thomas Krebs wrote:
>
> > Although I set my classpath to the cocoon.jar, cocoon does only startup
> > if I extract the files into the classes directory of the context for
> > cocoon.
> > Any ideas?
> >
> > cheers,
> > thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: jar files in classpath

Posted by Charles Yates <ce...@attglobal.net>.
A very useful way to do this is to put any jar files you use frequently
into $JAVA_HOME/jre/lib/ext.  They are then automatically in the
classpath without having to specify on the command line or in any
configuration files.

Carel-J Rischmuller wrote:

> Do you specifically specify the jar file in the classpath, or do you just
> set
> the path of where the jar file lies?
> i.e.    CLASSPATH=/lib/cocoon/cocoon.jar
> instead of
>          CLASSPATH=/lib/cocoon/
>
> The first one is the correct one.
>
> Cheerio
> Carel-J
>
> Thomas Krebs wrote:
>
> > Although I set my classpath to the cocoon.jar, cocoon does only startup
> > if I extract the files into the classes directory of the context for
> > cocoon.
> > Any ideas?
> >
> > cheers,
> > thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: jar files in classpath

Posted by Carel-J Rischmuller <ca...@epiuse.com>.
Do you specifically specify the jar file in the classpath, or do you just
set
the path of where the jar file lies?
i.e.    CLASSPATH=/lib/cocoon/cocoon.jar
instead of
         CLASSPATH=/lib/cocoon/

The first one is the correct one.

Cheerio
Carel-J

Thomas Krebs wrote:

> Although I set my classpath to the cocoon.jar, cocoon does only startup
> if I extract the files into the classes directory of the context for
> cocoon.
> Any ideas?
>
> cheers,
> thomas