Compiling Java 7 code via Maven

前端 未结 18 1461
夕颜
夕颜 2020-12-04 07:10

My pom file lists


  
    
        
            
                

        
18条回答
  •  Happy的楠姐
    2020-12-04 08:04

    I had the same problem. I found that this is because the Maven script looks at the CurrentJDK link below and finds a 1.6 JDK. Even if you install the latest JDK this is not resolved. While you could just set JAVA_HOME in your $HOME/.bash_profile script I chose to fix the symbolic link instead as follows:

    ls -l /System/Library/Frameworks/JavaVM.framework/Versions/
    total 64
    lrwxr-xr-x  1 root  wheel   10 30 Oct 16:18 1.4 -> CurrentJDK
    lrwxr-xr-x  1 root  wheel   10 30 Oct 16:18 1.4.2 -> CurrentJDK
    lrwxr-xr-x  1 root  wheel   10 30 Oct 16:18 1.5 -> CurrentJDK
    lrwxr-xr-x  1 root  wheel   10 30 Oct 16:18 1.5.0 -> CurrentJDK
    lrwxr-xr-x  1 root  wheel   10 30 Oct 16:18 1.6 -> CurrentJDK
    lrwxr-xr-x  1 root  wheel   10 30 Oct 16:18 1.6.0 -> CurrentJDK
    drwxr-xr-x  9 root  wheel  306 11 Nov 21:20 A
    lrwxr-xr-x  1 root  wheel    1 30 Oct 16:18 Current -> A
    lrwxr-xr-x  1 root  wheel   59 30 Oct 16:18 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
    

    Notice that CurrentJDK points at 1.6.0.jdk

    To fix it I ran the following commands (you should check your installed version and adapt accordingly).

    sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
    sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
    

提交回复
热议问题