How can I set my Cygwin PATH to find javac?

liv2hak picture liv2hak · Feb 7, 2011 · Viewed 102k times · Source

I have a Windows 7 system on which I have installed the latest Java compiler. I also have the latest Cygwin. I want to use the Java compiler from Cygwin's shell. I edited the PATH variable in Cygwin as follows:

export PATH=$PATH:"/cygdrive/C/Program\ Files/Java/jdk1.6.0_23/bin/"

I can see the javac binary in the above directory, however when I try to compile my *.java file I get:

javac command not found

Am I doing something wrong in setting the PATH variable like this? Do I have to do something else? I am new to Java and not very familiar with cygwin.

Answer

lweller picture lweller · Feb 7, 2011

as you write the it with double-quotes, you don't need to escape spaces with \

export PATH=$PATH:"/cygdrive/C/Program Files/Java/jdk1.6.0_23/bin/"

of course this also works:

export PATH=$PATH:/cygdrive/C/Program\ Files/Java/jdk1.6.0_23/bin/