Reputation: 2771
I'm having an odd problem, when attempting to build my application using Maven, on the command line. (Other questions I've seen on SO are referring to building within Eclipse, or some other IDE)
When I attempt to build, maven complains that it cannot find Javac in tools.jar. Looking at the given location, it is obvious that Maven is looking in the JRE directory, however, I seem unable to get Maven to point to the correct Java_home for my JDK - any ideas on how this should be done?
Environment Overview
JAVA_HOME=C:\jdk1.6.0_27
Path=C:\jdk1.6.0_27\bin;...... (showing the jdk is the first thing on the path)
D:\> javac -version
javac 1.6.0_27 <-- This is correct
D:\>java -version
java version "1.6.0_31" <-- wtf?
D:\>mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.6.0_31 <--- This is the problem - Where
Java home: C:\Program Files (x86)\Java\jre6 <--- does Maven get this from?
Any light you could shed on this would be most welcome.
Upvotes: 1
Views: 3277
Reputation: 1406
Try Configure the toolchains.xml in your maven directory (e.g D:\maven-2.2.1\conf) to your java version
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.5</version> <!--This should be same as is configured via the toolchains plugin -->
<vendor>ibm</vendor> <!--This should be same as is configured via the toolchains plugin -->
</provides>
<configuration>
<jdkHome>C:\Program Files\Java\jdk1.5.0</jdkHome>
</configuration>
</toolchain>
</toolchains>
Upvotes: 1
Reputation: 2390
have you looked at your your build-local.properties or build.properties? possibly still pointing to theJRE there. This has to purely be a build path issue somewhere along the path.
Sorry for listing this as an answer for i cant seem to add comments.
Upvotes: 0