[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-dev
Subject:    Setting the classpath
From:       "Dave Bowers" <vive_lafrique () yahoo ! com>
Date:       2005-04-08 22:05:09
[Download RAW message or body]

I was just looking through the dev list archives to see how many people had
complained about the complexity of setting the classpath in groovy.

I don't understand Classworlds too well yet, but I was wondering if a groovy
script could support the following under certain cases.
#!/usr/bin/groovy
#!cw:main is groovy.ui.GroovyMain from groovy
#!cw:
#!cw:[groovy]
#!cw:    load ${groovy.home}/conf
#!cw:    load ${groovy.home}/lib/*.jar

I know it's kind of ugly, but the use case is obvious.  Recommendations on a
better format would be welcom.  Allow a user to specify a classworlds-style
configuration at the beginning of the groovy script.  

This could then be parsed in a couple ways:
1.  Extend groovy.sh and groovy.bat to pre-parse the .groovy file for such
classworlds-style configurations.  If they exist, dump them to a temporary
file that the classworlds loader would use.
This gets *very* messy, especially in Windows batch world.  Maybe a generic
Perl script would accomplish about the same thing and still have as broad an
interest.
2.  Extend org.codehaus.classworlds.Launcher, and the subclass would
accomplish the same thing, but it would all be in Java and it would be
generic.  I don't know anything about classworlds.  Maybe they already
provide some sort of pre-processing hook?

Obviously, if someone used a different entry-point to groovy, then the
parser would skip all this.  But if someone has their own entry-point, then
they've probably already solved their classpath problems.

Comments?

-David Bowers

-----Original Message-----
From: Russel Winder [mailto:russel@russel.org.uk] 
Sent: Friday, January 28, 2005 7:47
To: Groovy Developers
Subject: Re: [groovy-dev] Gnome and Groovy

On Fri, 2005-01-28 at 13:36 +0100, Jochen Theodorou wrote:

> > Thanks muchly for this.  Clearly Groovy needs to do no work as 
> > java-gnome has done it all for us!  I like it.
> 
> that's one big reason for using groovy ;)

The big downside of course is having to have a preprepared CLASSPATH and
LD_LIBRARY_PATH or use ant to drive things.  Sort of ruins a bit the point
of Groovy -- though I guess the CLASSPATH at least could be manipulated by
Groovy at runtime.

--
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             russel@russel.org.uk


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic