[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The evils of /usr/share/java/repository

Jeff Turner <jeff@socialchange.net.au> writes:

> On Wed, Sep 19, 2001 at 03:35:20AM +0200, Anders Jackson wrote:
> > Jeff Turner <jeff@socialchange.net.au> writes:
> > 
> > [...]
> > 
> > > As long as it's not purely additive. I want to be able to remove stuff
> > > from the classpath, not just add my stuff. There are various subtle
> > > problems that can occur otherwise:
> > 
> > Make /usr/bin/java a modified version of your proj.sh, wher you add
> > that if you set CLASSPATH, proj.sh (or /usr/bin/java) only adds system
> > class-path to your CLASSPATH with stuff that is needed to run a basic
> > clean Java machine.  Or even doesn't add anything at all.
> Do you mean something like:
> if [ -z "$CLASSPATH" ]; then
>   for jar in /usr/share/lib/*.jar; do
> 	  export CLASSPATH=$CLASSPATH:$jar
>   done
> else
>   # do nothing, or something very minimal
> fi

Yes.  Something like that.

> > Then you can override system class-path.
> Yep, it's a possibility, but a bit kludgey.

Well, it's easy to understand.

> Maybe there could be two files, ~/.cp_add and ~/.cp_remove. Each
> contains regexps of files to add to and remove from the classpath,
> respectively.
> So if I don't want anything, I put in my ~/.cp_remove:
> *
> To only remove jaxp, I'd put:
> *jaxp*.jar
> And if I have a directory of jars I frequently use (~/jars), I could put this in
> my ~/.cp_add:
> ~/jars/*.jar
> Not sure how this could be implemented in /bin/sh though.
> --Jeff

Hmm, I would call that kludgey.  ;-) ;-)
(As we say in Sweden, "Smaken är som baken, delad")

What about a tool that adds jars to (or removes from) a PATH.  Then
you could set that PATH to CLASSPATH.  

setenv CLASSPATH=`djava-add kaffe +libjar1 +libjar2 -libjar3`

This should set CLASSPATH to a value that will make it runnable by
kaffe and it has libjar1, libjar2 in path but not libjar3.  It should
build that from the old value of CLASSPATH (or CLASSPATH for kaffe
maybe, that would be build when you install kaffe or jars.  Have an
look how emacs does it with .el-packages).

If libjar1 and libjar2 isn't installed, you would get an error message.
If libjar1 or libjar2 doesn't run on kaffe, you would get an error message.

Would that help you?

Well, I'm going to bed now.  It's starting to be early here.  ;)


Reply to: