in reply to CLASSPATH in perl on windows using cygwin

Adding to this, I would like to know what is the best way to set the classpath from PERL script. Do I need to hardcode the path inside the script, or should it be read from a separate file and do something like:
$ENV{CLASSPATH}=`cat file_with_classpath`;
This further confuses me, since why not just do
$CLASSPATH=`cat file_with_classpath`;
since the java will be called as:java -classpath $CLASSPATH myprogram abc`;
I am finding this really confusing. !! Please clarify.

Replies are listed 'Best First'.
Re^2: CLASSPATH in perl on windows using cygwin
by hardburn (Abbot) on Aug 26, 2004 at 18:50 UTC

    $CLASSPATH=`cat file_with_classpath`; is perfectly acceptable, and probably better in general than setting an environment var. I might have Perl open the file on its own to read the contents instead of calling cat, though. IO::All is nice for this:

    use IO::All; $CLASSPATH = io('file_with_classpath')->slurp;

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.