Mercurial > hg > zsh-env
comparison zshrc-jdk @ 165:6dd02b1ebb80
use java-config again for selecting JDKs
author | Dirk Olmes <dirk.olmes@codedo.de> |
---|---|
date | Wed, 19 Feb 2020 08:20:33 +0100 |
parents | 2f71ba394858 |
children | d84faf4d53ac |
comparison
equal
deleted
inserted
replaced
164:20ac5fedc060 | 165:6dd02b1ebb80 |
---|---|
3 # | 3 # |
4 | 4 |
5 switchJdk() { | 5 switchJdk() { |
6 local jdkName="$1" | 6 local jdkName="$1" |
7 local new_path=$(removeFromPath "jdk") | 7 local new_path=$(removeFromPath "jdk") |
8 export JAVA_HOME=$(/usr/bin/java-config-2 --select-vm=${jdkName} -O) | 8 export JAVA_HOME=$(java-config-2 --select-vm=${jdkName} -O) |
9 export JAVAC=${JAVA_HOME}/bin/javac | 9 export JAVAC=${JAVA_HOME}/bin/javac |
10 export JDK_HOME=${JAVA_HOME} | 10 export JDK_HOME=${JAVA_HOME} |
11 export PATH="${JAVA_HOME}/bin":"${new_path}" | 11 export PATH="${JAVA_HOME}/bin":"${new_path}" |
12 java -version | 12 java -version |
13 } | 13 } |
15 jdk8() { | 15 jdk8() { |
16 switchJdk "oracle-jdk-bin-1.8" | 16 switchJdk "oracle-jdk-bin-1.8" |
17 } | 17 } |
18 | 18 |
19 openjdk8() { | 19 openjdk8() { |
20 export JAVA_HOME=/opt/openjdk-bin-8.222_p10 | 20 switchJdk "openjdk-bin-8" |
21 | |
22 local new_path=$(removeFromPath "jdk") | |
23 export PATH="${JAVA_HOME}/bin":"${new_path}" | |
24 java -version | |
25 } | |
26 | |
27 openjdk12() { | |
28 switchJdk "openjdk-bin-12" | |
29 } | 21 } |
30 | 22 |
31 openjdk13() { | 23 openjdk13() { |
32 switchJdk "openjdk-bin-13" | 24 switchJdk "openjdk-bin-13" |
33 } | 25 } |