Changeset 29010

Show
Ignore:
Timestamp:
30.04.2014 15:43:40 (5 years ago)
Author:
ak19
Message:

A much simpler version to find java home (default JDK) on any Mac OS found on a website. Tested on maverick, lion, leopard

Location:
main/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/findjava.sh

    r28829 r29010  
    7070    HINT=`cd "$GSDLHOME";pwd`/packages/jre 
    7171    elif [ "$GSDLOS" = "darwin" ]; then 
    72     osversion=`uname -r | sed 's/\..*$//'`;  
    73     # mac maverick is version 13 
    74     if [ $osversion -ge 13 ] ; then  
    75         # To work out java: 
    76         # 1. run "which java", which for example prints /usr/bin/java 
    77         # 2a. then do "ls -la" on that. The result is for example 
    78         # lrwxr-xr-x  1 root  wheel  74 20 Jan 15:08 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java 
    79         # 2b. remove everything before the symlink portion (before the "-> "), to get 
    80         # /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java 
    81         # 3. then suffix "_home" to it, to get 
    82         # /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home 
    83         # 4. Then run this executable, which will tell you JAVA_HOME, e.g. 
    84         # /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 
    85  
    86         whichjava=`which java`; 
    87         symlink=`ls -la $whichjava | sed 's/[^>]*> //'` 
    88         javahome=$symlink"_home" 
    89         HINT=`$javahome`         
    90     else 
    91         HINT=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 
    92         #/System/Library/Frameworks/JavaVM.framework/Home 
    93     fi 
    94  
     72    # http://java.dzone.com/articles/java-findingsetting 
     73    # explains that /usr/libexec/java_home will print the default JDK 
     74    # regardless of which Mac OS we're on. Tested on Maverick, Lion, Leopard 
     75    # (run `/usr/libexec/java_home -v 1.7` to find a specific version) 
     76    HINT=`/usr/libexec/java_home` 
    9577    fi   
    9678     
  • main/trunk/greenstone2/findjava.sh

    r28799 r29010  
    7070    HINT=`cd "$GSDLHOME";pwd`/packages/jre 
    7171    elif [ $GSDLOS = darwin ]; then 
    72     HINT=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 
     72    # http://java.dzone.com/articles/java-findingsetting 
     73    # explains that /usr/libexec/java_home will print out the default JDK 
     74    # regardless of which Mac OS we're on. Tested on Maverick, Lion, Leopard 
     75    # (run `/usr/libexec/java_home -v 1.7` to find a specific version) 
     76    HINT=`/usr/libexec/java_home` 
     77 
     78    #HINT=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 
    7379        #/System/Library/Frameworks/JavaVM.framework/Home 
    7480    fi