![How to set classpath on mac for java](https://kumkoniak.com/113.png)
![how to set classpath on mac for java how to set classpath on mac for java](https://skyeycapital800.weebly.com/uploads/1/2/6/6/126631969/540360218.png)
You can see that the editor for writing into this file is open now. If you see the error regarding a problem in finding the file then you need to create this file. When you are located in home, type this: cat.
![how to set classpath on mac for java how to set classpath on mac for java](https://i.ytimg.com/vi/DF0QDhoETO8/maxresdefault.jpg)
Simply cd to the home (I mean the user directory) - in any path if you just type cd and press enter, you can go to the home. Second, we need to check whether we have the.bash_profile or not. This is the path that needs to be defined in PATH environment. In fact, Home is the path of the directory that contains the subdirectory named "bin" which contains all the java binary files needed for running java. It might be a little different from me but my bin directory is in this path: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/ Then continue cd to the inner directories to reach to the bin file. Then do one "ls" to see what you have in this directory. 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.First, you need to find where the bin directory that contains all java binary files is located. 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. 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".
![how to set classpath on mac for java how to set classpath on mac for java](https://miro.medium.com/max/2000/1*YaoSCJRDq85UxlcsG24pMQ.jpeg)
![how to set classpath on mac for java how to set classpath on mac for java](https://www.thegeeksclub.com/wp-content/uploads/2011/11/java-classpath-1.jpg)
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
![How to set classpath on mac for java](https://kumkoniak.com/113.png)