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. Go to System Preferences Click on the Java icon to access the Java Control Panel. Find the Java Control Panel on Mac Launch the Java Control Panel on Mac (10.7.3 and above) Click on Apple icon on upper left of screen. 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. The information on this page pertains to Oracle Java starting with Java 7, supported with Mac versions 10.7.3 and above.
![setting classpath java mac os setting classpath java mac os](https://www3.ntu.edu.sg/home/ehchua/programming/java/images/JavaBasics_GettingStarted.png)
SETTING CLASSPATH JAVA MAC OS PLUS
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".
SETTING CLASSPATH JAVA MAC OS MAC OS X
In summary, if you are trying to figure out where JAVAHOME is on your Mac OS X system, I hope this has been helpful. It’s an environment variable that provides an application with - Selection from. You might also be able to find some of these settings in the Mac OS X Control Panel, but I looked just now, and did not see them (though you can see Java's 'temporary internet files' from that console).
![setting classpath java mac os setting classpath java mac os](https://code.visualstudio.com/assets/docs/java/java-project/overflow-button.png)
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 The Classpath The concept of a path should be familiar to anyone who has worked on a DOS or Unix platform. 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. I'm trying to get my Apache Lucene demo to work and I'm down to setting the classpath in this tutorial 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'.