简体   繁体   中英

Maven uses wrong jdk

I have env.variable $JAVA_HOME it points to folder with jdk7 but if I execute "mvn -version" I see next

MacBook-Pro-Erik:~ erik$ mvn -version
728-version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 06:15:32+0400)
Maven home: /Users/erik/distribs/maven/apache-maven-3.1.0
Java version: 1.6.0_51, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"

How to enforce maven to use correct jdk? I have java.lang.UnsupportedClassVersionError becouse of this issue :(

解决方法:

echo JAVA_HOME=`/usr/libexec/java_home -v 1.7` | sudo tee -a /etc/mavenrc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM