Whitespaces in CLASSPATH
Posted
by Shyam
on Stack Overflow
See other posts from Stack Overflow
or by Shyam
Published on 2010-06-09T07:29:49Z
Indexed on
2010/06/09
7:32 UTC
Read the original article
Hit count: 252
I am working on a Windows PC and have cygwin on it!
I have organized all my jars under a directory within a few directories!
I am writing a bash
script to set the CLASSPATH
by iterating through the directory that is passed as a parameter as follows:
for JAR_FILE in `ls *.jar`
do
CLASSPATH="$DIRECTORY_TO_LOOK_FOR_JARS"/$JAR_FILE:$CLASSPATH
done
Whenever there are spaces in the directory that is passed like /cygdrive/c/Documents and Settings/user/My Jars
and I run java -cp $CLASSPATH somepackage.someclass
, it throws an error stating that the class and
is not found, because the CLASSPATH variable is getting split after /cygdrive/c/Documents
.
Can someone help me to solve this issue?
© Stack Overflow or respective owner