How can I set my Cygwin PATH to find javac?
Java binaries may be under "Program Files" or "Program Files (x86)": those white spaces will likely affect the behaviour.
In order to set up env variables correctly, I suggest gathering some info before starting:
- Open DOS shell (type cmd into 'RUN' box) go to C:\
- type "dir /x" and take note of DOS names (with ~) for "Program Files *" folders
Cygwin configuration:
go under C:\cygwin\home\, then open .bash_profile and add the following two lines (conveniently customized in order to match you actual JDK path)
export JAVA_HOME="/cygdrive/c/PROGRA~1/Java/jdk1.8.0_65"
export PATH="$JAVA_HOME/bin:$PATH"
Now from Cygwin launch
javac -version
to check if the configuration is successful.
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/