view zshrc-jdk @ 159:d0cdc3f47182

oops we already had a zsh enabling .profile
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 14 Dec 2019 06:17:27 +0100
parents 2f71ba394858
children 6dd02b1ebb80
line wrap: on
line source

#
# zshrc for handling different JDK versions
#

switchJdk() {
    local jdkName="$1"
    local new_path=$(removeFromPath "jdk")
    export JAVA_HOME=$(/usr/bin/java-config-2 --select-vm=${jdkName} -O)
    export JAVAC=${JAVA_HOME}/bin/javac
    export JDK_HOME=${JAVA_HOME}
    export PATH="${JAVA_HOME}/bin":"${new_path}"
    java -version
}

jdk8() {
    switchJdk "oracle-jdk-bin-1.8"
}

openjdk8() {
    export JAVA_HOME=/opt/openjdk-bin-8.222_p10

    local new_path=$(removeFromPath "jdk")
    export PATH="${JAVA_HOME}/bin":"${new_path}"
    java -version
}

openjdk12() {
    switchJdk "openjdk-bin-12"
}

openjdk13() {
    switchJdk "openjdk-bin-13"
}