In your case it would look something like: Phil-hunters-MacBook:webapps philhunter$ java -cp /Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar .IndexFiles /Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/srcĪs an aside, the error you see when using the setenv line is because setenv is the command used in the C shell to set environment variables, but the default Mac shell (and the shell you're using) is bash which doesn't recognise setenv and lets you know it doesn't recognise it with the error message: -bash: setenv: command not found. However, with java the usual way of setting the classpath is to do it as part of the java command itself, using the -classpath or -cp options. To set the class path with a command-line option, run your Java class like this: java -classpath javaclasspath class javaclasspath The class path. This basically says "set the CLASSPATH variable to its current value plus the location of the lucene jar, and make the new variable available to any processes launched from this shell". I've hunted the web and these wer the 2 solutions I found to set CLASSPATH: CLASSPATH=$:/Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar I'm trying to get my Apache Lucene demo to work and I'm down to setting the classpath in this tutorial 1) Open a terminal window 2) Open /.bashprofile file and add the below line: export JAVAHOME(/usr/libexec/javahome -v 1.7) or 3) Close the terminal.
0 Comments
Leave a Reply. |