0

I am having some trouble building a Maven project on my Windows machine. I have set my JAVA_HOME environment variable and Maven finds it.

Here are come results from a few executions:

'which mvn'

/cygdrive/c/Program Files/Apache/apache-maven-3.0.5/bin/mvn

'mvn -version'

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28 0800)
Maven home: C:\Program Files\Apache\apache-maven-3.0.5
Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "windows"

Note: It does find the proper JAVA_HOME path here!

Building w/ Maven:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
0.2:compile (default-compile) on project sportbukkit-api: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre6\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.

As you can see, for some reason it is looking in the completely wrong directory. Please let me know if any more info is needed or if you know how to fix this! Thank you!

  • Your JAVA_HOME may point to jre path, you could change it to jdk by editing mvn.bat or JAVA_HOME environment variable. – Xiujun Ma Jun 17 '13 at 02:25

1 Answers1

0

Try setting your JAVA_HOME to C:\Program Files\Java\jdk1.6.0_45 instead of C:\Program Files\Java\jdk1.6.0_45\jre

gerrytan
  • 40,313
  • 9
  • 84
  • 99