Re: setting the class path -an easier way

2003-06-16 Thread Shanu
Hi Paul,
 Following script can be used to set the path dynamically.. 

#!/bin/tcsh
set classpath=.
set alljars=""
foreach i (`find . -name "*.jar"`)
  set alljars=($i":"$alljars)
end
set CLASSPATH=($CLASSPATH$alljars$classpath)
echo $CLASSPATH
export $CLASSPATH 

   So, tomorrow even if you add some jars in /home/paul/java/jars/ dir 
and run the script from the same dir would add for you, all the jar files in 
the :/home/paul/java/jars/ dir and its subdir to the classpath. 

Regards,
Shanu. 

Paul Tremblay writes: 

I just installed java 1.41 on my linux box. By default, Mandrake
installs kaffee, and I've had problems with kaffee in the past. As with
the last time, installing java is almost too easy. No builds, no make
installs--it's just there! 

However, I wondered if someone could help me with an easy way to set the
CLASSPATH for various applications. Does one have to set the CLASSPATH
for every single application? Is there not an easier way? 

For example, I have installed xalan. In my ./bashprofile, I have: 

export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/xsltc.jar
export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/BCEL.jar
export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/bsf.jar
export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/java_cup.jar
export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/JLex.jar
export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/regexp.jar 

export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/runtime.jar 

export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/regexp.jar 

export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/xalansamples.jar
export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/xalanservlet.jar 

export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/xercesImpl.jar 

export CLASSPATH=$CLASSPATH:/home/paul/java/jars/xalan-j_2_3_1/bin/xml-apis.jar 

This gets real tedious. And this is for just one application.  

I know with python, for example, you can just tell python to look in one
folder for all the libraries.  

Is there a way to do this with java? Is there an easier way to create
the CLASSPATH? 

thanks 

Paul 

--  


*Paul Tremblay *
[EMAIL PROTECTED]
 

--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] 



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


Re: setting the class path -an easier way

2003-06-16 Thread Paul Tremblay
On Mon, Jun 16, 2003 at 11:30:50AM +0530, Shanu wrote:
> 
> Hi Paul,
>  Following script can be used to set the path dynamically.. 
> 
> #!/bin/tcsh
> set classpath=.
> set alljars=""
> foreach i (`find . -name "*.jar"`)
>   set alljars=($i":"$alljars)
> end
> set CLASSPATH=($CLASSPATH$alljars$classpath)
> echo $CLASSPATH
> export $CLASSPATH 
> 
>So, tomorrow even if you add some jars in /home/paul/java/jars/ dir 
> and run the script from the same dir would add for you, all the jar files 
> in the :/home/paul/java/jars/ dir and its subdir to the classpath. 
> 

This would add *every* jar to my CLASSPATH, which I guess is what I
want. 

Should the fourth line not be:


foreach i (`find / -name "*.jar"`)

?

What happens if I am in a directory /home/paul/Documents? Then again, I
guess that find will choke if it tries to find files in a directory to
which I have no access.

Nevertheless, this script is very poweful simple, and it is what I wil
use! 

Thanks

Paul


-- 


*Paul Tremblay *
[EMAIL PROTECTED]



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]