[
https://jira.codehaus.org/browse/MNG-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=350380#comment-350380
]
Hans Aikema commented on MNG-4226:
----------------------------------
This is not fixed, or broken again. On my MacPro running Mavericks:
abu:bin aikebah$ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
abu:bin aikebah$ ./mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e;
2014-06-17T15:51:42+02:00)
Maven home: /Users/aikebah/Documents/Apps/apache-maven-3.2.2
Java version: 1.6.0_65, 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.9.4", arch: "x86_64", family: "mac"
abu:bin aikebah$
> Better detection of JAVA_HOME on Apple Mac OS X
> -----------------------------------------------
>
> Key: MNG-4226
> URL: https://jira.codehaus.org/browse/MNG-4226
> Project: Maven
> Issue Type: Improvement
> Components: Command Line
> Reporter: Alin Dreghiciu
> Assignee: Jason van Zyl
> Fix For: 3.2.2
>
> Attachments: 0001-MNG-4226-Detect-JAVA_HOME-on-newer-Mac-OS-X.patch,
> MNG-4226-apache-maven.patch
>
>
> On mac JAVA_HOME is detected by using the following code:
> {code}
> if [ -z "$JAVA_VERSION" ] ; then
> JAVA_VERSION="CurrentJDK"
> else
> echo "Using Java version: $JAVA_VERSION"
> fi
> if [ -z "$JAVA_HOME" ] ; then
>
> JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
> fi
> {code}
> But this does not work in collaboration with Using "Java preferences" to
> change the actual java version to use as "CurrentJDK" does not change once
> you update the "java applications" order.
> There is an alternative (at least on Leopard) for determining current java
> home that is based on Java Preferences by using an apple provided script. So,
> as a replacement fo rthe code above the following could be used.
> {code}
> if [ -z "$JAVA_HOME" ] ; then
> JAVA_HOME=`/usr/libexec/java_home | tail -1`
> fi
> {code}
> Could also be taht this is teh first attempt and if fails use the current way
> of determining home.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)