Mercurial > hg > zsh-env
annotate zshrc-jdk @ 184:3e3c8aa16bef
option morespace entfernt
author | Dirk Olmes <dirk.olmes@codedo.de> |
---|---|
date | Fri, 22 Oct 2021 11:28:24 +0200 |
parents | 51710c7c26c2 |
children |
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 |
176 | 15 openjdk8() { |
16 switchJdk "openjdk-bin-8" | |
48 | 17 } |
131
e72a98823522
update the jdk support module
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
48
diff
changeset
|
18 |
176 | 19 openjdk11() { |
20 local new_path=$(removeFromPath "jdk") | |
178
51710c7c26c2
jdk 13 is superseeded by jdk 14, use the generic jdk 11 link
Dirk Olmes <dirk.olmes@codedo.de>
parents:
176
diff
changeset
|
21 export JAVA_HOME=/opt/openjdk-bin-11 |
176 | 22 export JAVAC=${JAVA_HOME}/bin/javac |
23 export JDK_HOME=${JAVA_HOME} | |
24 export PATH="${JAVA_HOME}/bin":"${new_path}" | |
25 java -version | |
156 | 26 } |
155 | 27 |
178
51710c7c26c2
jdk 13 is superseeded by jdk 14, use the generic jdk 11 link
Dirk Olmes <dirk.olmes@codedo.de>
parents:
176
diff
changeset
|
28 openjdk14() { |
51710c7c26c2
jdk 13 is superseeded by jdk 14, use the generic jdk 11 link
Dirk Olmes <dirk.olmes@codedo.de>
parents:
176
diff
changeset
|
29 switchJdk "openjdk-bin-14" |
155 | 30 } |