Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X?

后端 未结 5 1780
走了就别回头了
走了就别回头了 2020-11-30 17:26

I am testing my current application with Mac OS X which has Java 7 from Oracle installed. Instead using Java 7 from Oracle, it\'s using Java 6 from Apple. The default system

5条回答
  •  旧巷少年郎
    2020-11-30 18:01

    EDIT: Uwe's impressive answer is absolutely correct for the OP who it turns out was using the AppLauncher. My initial read of the question was that it related to command-line issues on OSX with Java 6 vs Java 7. The comments on the original question show I was wrong. However, anyone having command-line issues may find the below a simpler solution.

    ORIGINAL: My circumstances seemed the same as I thought the OP had: Java 1.7 perfectly on the command-line but mvn failing and complaining about 1.6, general compilation had been working fine using sbt and IntelliJ. I only started having problems compiling a third-party project with mvn.

    I found this to work well and be much simpler:

    http://www.jayway.com/2013/03/08/configuring-maven-to-use-java-7-on-mac-os-x/

    All I needed from that was the following in .profile:

    export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
    

    Set that variable and mvn worked well.

提交回复
热议问题