source: core/c/find-java-home @ 9134d28

Last change on this file since 9134d28 was 37521c6, checked in by kytv <kytv@…>, 7 years ago

look for openjdk6 in OpenBSD if v7 isn't available

  • Property mode set to 100644
File size: 2.0 KB
Line 
1UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
2if [ $UNIXTYPE = "freebsd" ]; then
3    if [ -d /usr/local/openjdk6 ]; then
4        JAVA_HOME="/usr/local/openjdk6"
5    elif [ -d /usr/local/openjdk7 ]; then
6        JAVA_HOME="/usr/local/openjdk7"
7    fi
8elif [ $UNIXTYPE = "sunos" ]; then
9    UNIXTYPE="solaris"
10    if [ -d /usr/jdk/latest/ ]; then
11        JAVA_HOME="/usr/jdk/latest"
12    elif [ -d /usr/jdk/instances/jdk1.7.0/ ]; then
13        JAVA_HOME="/usr/jdk/instances/jdk1.7.0"
14    elif [ -d /usr/jdk/instances/jdk1.6.0 ]; then
15        JAVA_HOME="/usr/jdk/instances/jdk1.6.0"
16    fi
17elif [ $UNIXTYPE = "openbsd" ]; then
18    if [ -d /usr/local/jdk-1.7.0 ]; then
19        JAVA_HOME="/usr/local/jdk-1.7.0"
20    elif [ -d /usr/local/jdk-1.6.0 ]; then
21        JAVA_HOME="/usr/local/jdk-1.6.0"
22    fi
23elif [ $UNIXTYPE = "netbsd" ]; then
24    if [ -d /usr/pkg/java/openjdk7 ]; then
25        JAVA_HOME="/usr/pkg/java/openjdk7"
26    fi
27elif [ $UNIXTYPE = "linux" ] && [ -e /etc/debian_version ]; then
28    if [ -d /usr/lib/jvm/default-java ]; then
29       JAVA_HOME="/usr/lib/jvm/default-java"
30    fi
31elif [ $UNIXTYPE = "linux" ] && [ -e /etc/arch-release ]; then
32    if [ -d /usr/lib/jvm/java-7-openjdk ]; then
33        JAVA_HOME="/usr/lib/jvm/java-7-openjdk"
34    elif [ -d /usr/lib/jvm/java-6-openjdk ]; then
35        JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
36    fi
37elif [ $UNIXTYPE = "darwin" ]; then
38    JAVA_HOME=$(/usr/libexec/java_home)
39elif [ $UNIXTYPE = "gnu/kfreebsd" ]; then
40    # Even though the kernel is FreeBSD's, the userland is GNU.
41    # kFreeBSD has $JAVA_HOME/include/linux instead of $JAVA_HOME/include/*bsd
42    UNIXTYPE="linux"
43    # OpenJDK 7 is supported as of Debian Jessie
44    if [ -d /usr/lib/jvm/java-7-openjdk-kfreebsd-amd64/ ]; then
45        JAVA_HOME="/usr/lib/jvm/java-7-openjdk-kfreebsd-amd64"
46    elif [ -d /usr/lib/jvm/java-7-openjdk-kfreebsd-i386/ ]; then
47        JAVA_HOME="/usr/lib/jvm/java-7-openjdk-kfreebsd-i386"
48    elif [ -d /usr/lib/jvm/java-gcj ]; then
49        JAVA_HOME="/usr/lib/jvm/java-gcj"
50    fi
51fi
52
53export JAVA_HOME UNIXTYPE
Note: See TracBrowser for help on using the repository browser.