Builds failing after upgrading to Java7, Missing Tools.jar and bad class versions

后端 未结 8 1762
滥情空心
滥情空心 2020-12-08 17:55

I recently upgraded to Java7 on my Macbook Pro. I downloaded the JDK (not the JRE).

» javac version
javac 1.7.0_17

» echo $JAVA_HOME    
/Library/Java/Java         


        
8条回答
  •  清歌不尽
    2020-12-08 18:20

    I got the following error on a maven project: Failed to execute goal on project cobertura-maven-plugin: Could not resolve dependencies for project org.codehaus.mojo:cobertura-maven-plugin:maven-plugin:2.6: Could not find artifact com.sun:tools:jar:0 at specified path /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../lib/tools.jar -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project cobertura-maven-plugin: Could not resolve dependencies for project org.codehaus.mojo:cobertura-maven-plugin:maven-plugin:2.6: Could not find artifact com.sun:tools:jar:0 at specified path /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../lib/tools.jar

    I fixed it by creating a lib dir under /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents and adding tools.jar to it.

    Full path would be this for tools.jar in this particular instance: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/lib/tools.jar

提交回复
热议问题