When you set the environment variable as CLASSPATH , by default it applies only to the current process (i.e. the shell process itself) - it is not available for the Java process that you run on the next line. To make it available to other processes, you need to "export" the variable. In this case, you can use something like:
export CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar
Basically it says: "Set the CLASSPATH variable to the current value plus the location of the lucene banner and make the new variable available to any processes running from this shell."
However, using java, the usual way to set the class path is to execute it as part of the java command itself using the -classpath or -cp . In your case, it will look something like this:
Phil-hunters-MacBook:webapps philhunter$ java -cp /Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar org.apache.lucene.demo.IndexFiles /Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/src
As an aside, the error you see when using the setenv line is that setenv is the command used in the C shell to set environment variables, but the default Mac shell (and the shell you use) is bash that doesn't recognize setenv and lets you know that it does not recognize it with the error message: -bash: setenv: command not found .
source share