0

I'm trying to get Maven to work on my Windows 7 OS.

$ mvn -v
which: no javac in (/jre/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/OpenSSH/bin:/cygdrive/c/Program Files (x86)/Symantec/VIP Access Client:/cygdrive/c/Program Files (x86)/Skype/Phone:/cygdrive/c/Program Files (x86)/apache-maven-3.3.9/bin: C:/Program Files (x86)/Java/jre1.8.0_91:/cygdrive/c/texlive/2016/bin/win32:/cygdrive/c/Users/anyoung/AppData/Local/Box/Box Edit)
which: no java in (/jre/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/OpenSSH/bin:/cygdrive/c/Program Files (x86)/Symantec/VIP Access Client:/cygdrive/c/Program Files (x86)/Skype/Phone:/cygdrive/c/Program Files (x86)/apache-maven-3.3.9/bin: C:/Program Files (x86)/Java/jre1.8.0_91:/cygdrive/c/texlive/2016/bin/win32:/cygdrive/c/Users/anyoung/AppData/Local/Box/Box Edit)
Error: JAVA_HOME is not defined correctly.
  We cannot execute

After searching online, I found that I need to add the path of my Java installation to my system's PATH variable. However, I can't find the path to my Java installation:

$ whereis java
java:

$ which java
which: no java in (/jre/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/OpenSSH/bin:/cygdrive/c/Program Files (x86)/Symantec/VIP Access Client:/cygdrive/c/Program Files (x86)/Skype/Phone:/cygdrive/c/Program Files (x86)/apache-maven-3.3.9/bin: C:/Program Files (x86)/Java/jre1.8.0_91:/cygdrive/c/texlive/2016/bin/win32:/cygdrive/c/Users/anyoung/AppData/Local/Box/Box Edit)

I have verified that Java is installed (Version 8) by typing "Java" in my search bar. Any ideas on how to proceed?

user2205916
  • 3,196
  • 11
  • 54
  • 82
  • Can you run `which java` and share the result? – Mureinik Oct 24 '16 at 20:06
  • Come on... https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/ – christopher Oct 24 '16 at 20:06
  • add enviornmental variable JAVA_HOME to point to installation directory of java . – Jimmy Oct 24 '16 at 20:07
  • Closing as duplicate as one of the many questions with a highly similar title relating to setting JAVA_HOME on Windows. If you can differentiate your question from all of the other questions on the same topic already it can be reopened. – djechlin Oct 24 '16 at 20:10
  • @djechlin This is NOT A DUPLICATE. The problem is NOT in setting JAVA_HOME, but in setting the PATH correctly. – Klitos Kyriacou Oct 24 '16 at 20:13
  • @KlitosKyriacou http://stackoverflow.com/questions/4681090/how-do-i-find-where-jdk-is-installed-on-my-windows-machine? http://stackoverflow.com/questions/24174906/how-do-i-find-where-java-is-downloaded-on-a-windows-7-computer?noredirect=1&lq=1? – djechlin Oct 24 '16 at 20:14
  • 1
    @djechlin I can tell you exactly where the JRE is located in the OP's machine (it's in `C:\Program Files (x86)\Java\jre1.8.0_91`) but the problem is that he's got a space before it in the PATH which causes Cygwin to fail to recognize it as /cygdrive/c, and therefore fails to find it. He also doesn't appear to have a JDK (required for mvn) but only a JRE. So, as you can see, different issues to those you say are duplicates. – Klitos Kyriacou Oct 24 '16 at 20:19
  • You're mixing cygwin and native Windows paths in your PATH variable: `/cygdrive/c/Program Files (x86)/apache-maven-3.3.9/bin: C:/Program Files (x86)/Java/jre1.8.0_91` –  Oct 25 '16 at 20:00
  • @djechlin This particular problem is likely cygwin-related rather than Java-related. –  Oct 25 '16 at 20:01

0 Answers0