Mercurial > hg > zsh-env
annotate 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 |
rev | line source |
---|---|
0
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
1 # |
152 | 2 # zshrc for handling different JDK versions |
0
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
3 # |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
4 |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
5 switchJdk() { |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
6 local jdkName="$1" |
153 | 7 local new_path=$(removeFromPath "jdk") |
165
6dd02b1ebb80
use java-config again for selecting JDKs
Dirk Olmes <dirk.olmes@codedo.de>
parents:
156
diff
changeset
|
8 export JAVA_HOME=$(java-config-2 --select-vm=${jdkName} -O) |
0
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
9 export JAVAC=${JAVA_HOME}/bin/javac |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
10 export JDK_HOME=${JAVA_HOME} |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
11 export PATH="${JAVA_HOME}/bin":"${new_path}" |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
12 java -version |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
13 } |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
14 |
48 | 15 jdk8() { |
16 switchJdk "oracle-jdk-bin-1.8" | |
17 } | |
131
e72a98823522
update the jdk support module
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
48
diff
changeset
|
18 |
153 | 19 openjdk8() { |
165
6dd02b1ebb80
use java-config again for selecting JDKs
Dirk Olmes <dirk.olmes@codedo.de>
parents:
156
diff
changeset
|
20 switchJdk "openjdk-bin-8" |
156 | 21 } |
155 | 22 |
156 | 23 openjdk13() { |
24 switchJdk "openjdk-bin-13" | |
155 | 25 } |