-1

The question I have has been asked many times before on this site and all around the web. I have tried all the hints and suggestions I found in all those answers, and I still cannot manage to get things running. I want JDK to run in my Cygwin installation (Cygwin installed on a Windows 64 bit machine). I did not install the Linux JDK installation, but the Windows one, so the issue is in my opinion not there.

The location of my JDK installation on Windows is

    C:\Program Files (x86)\Java\jdk1.8.0_40 

I have added the following lines to my .bash_profile file (only this, no # signs or anything):

    export JAVA_HOME="/cygdrive/C/Program Files(x86)/Java/jdk1.8.0_40/"
    export PATH=$PATH:"/cygdrive/C/Program Files(x86)/Java/jdk1.8.0_40/bin"

I then start up Cygwin and type

    source .bash_profile
    javac -version

At which point I get the message

    -bash: javac: command not found

I've tried a dozen variants of the code (the internet is full of partially contradictory ideas), none have worked. Should I start to mess around in the .bashrc file as some sites suggest? Does anybody have an idea what I'm doing wrong?

Adriaan
  • 1
  • 1
  • 1

2 Answers2

0

You need to add the $JAVA_HOME/bin to PATH.

Otherwise the javac command would not automatically be recognized.

Crazyjavahacking
  • 9,343
  • 2
  • 31
  • 40
  • Okay, how should I do this? I have now tried `export PATH=$PATH:"/cygdrive/C/Program Files(x86)/Java/jdk1.8.0_40/bin":$JAVA_HOME/bin` and `export PATH=$PATH:$JAVA_HOME/bin` none of which work: I still get command not found. – Adriaan Apr 11 '15 at 11:24
0

I figured out the issue and of course somebody posted it on Stack Overflow before: export JAVA_HOME with spaces in Cygwin . The problem was the even with designating the directory with quotes, Cygwin still stumbled over the space between Program and Files.

Community
  • 1
  • 1
Adriaan
  • 1
  • 1
  • 1