2015-09-22 77 views
0

所以我有幾乎完全一樣的問題,因爲這傢伙適當的java:MVN不會承認

Maven Installation OSX Error Unsupported major.minor version 51.0

沒有在那裏工作,我....我認爲這個問題是在我的符號鏈接某處。我在.bash_profile中定義了$ JAVA_HOME,並且java -version正確地報告了版本。但是,由於某種原因,mvn正在嘗試使用舊版本的java。

這裏是我的機器上的所有內容的列表:

/usr/libexec/java_home -verbose 
Matching Java Virtual Machines (5): 
    1.8.0_40, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home 
    1.7.0_79, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home 
    1.7.0_75, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home 
    1.6.0_65-b14-466.1, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 
    1.6.0_65-b14-466.1, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 

我想使用1.8。並mvn承認它。

如果我運行此:

ls -l `which java` 
lrwxr-xr-x 1 root wheel 74 May 24 22:46 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java 

然後,如果我跑:

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java -version 
java version "1.8.0_40" 
Java(TM) SE Runtime Environment (build 1.8.0_40-b27) 
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode) 

我注意到這個符號鏈接失靈:

cd /System/Library/Frameworks/JavaVM.framework/Versions 
ls -l 
total 64 
lrwxr-xr-x 1 root wheel 10 May 24 22:46 1.4 -> CurrentJDK 
lrwxr-xr-x 1 root wheel 10 May 24 22:46 1.4.2 -> CurrentJDK 
lrwxr-xr-x 1 root wheel 10 May 24 22:46 1.5 -> CurrentJDK 
lrwxr-xr-x 1 root wheel 10 May 24 22:46 1.5.0 -> CurrentJDK 
lrwxr-xr-x 1 root wheel 10 May 24 22:46 1.6 -> CurrentJDK 
lrwxr-xr-x 1 root wheel 10 May 24 22:46 1.6.0 -> CurrentJDK 
drwxr-xr-x 7 root wheel 238 May 24 22:46 A 
lrwxr-xr-x 1 root wheel 1 May 24 22:46 Current -> A 
lrwxr-xr-x 1 root wheel 59 May 24 22:46 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents 

是 「CurrentJDK」 實際上在哪裏使用?如何更新鏈接?

我不明白髮生了什麼......一切似乎都指向新的Java,在哪裏以及如何mvn閱讀Java 6(Unsupported major.minor版本51.0)?

回答

0

/System/Library/Frameworks/JavaVM.framework/Versions中的符號鏈接指向舊的JDK。

運行這些命令修正它:

cd /System/Library/Frameworks/JavaVM.framework/Versions 
sudo rm CurrentJDK 
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/ CurrentJDK