-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjenv_install.sh
More file actions
executable file
·45 lines (37 loc) · 887 Bytes
/
Copy pathjenv_install.sh
File metadata and controls
executable file
·45 lines (37 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
function init_jenv() {
export PATH="${HOME}/.jenv/bin:${PATH}"
eval "$(jenv init -)"
}
function aux_jenv_reset() {
cd "$1" && printf "%s\n" "${PWD##*/}"
}
export -f aux_jenv_reset
function jenv_reset () {
echo "jenv_reset BEGIN"
echo "jenv versions # old"
jenv versions
echo
find "${HOME}/.jenv/versions" -mindepth 1 -maxdepth 1 -print0 | \
xargs -0 -I ^ /bin/bash -c "aux_jenv_reset \"^\"" | \
xargs jenv remove
echo
/usr/libexec/java_home -V
echo
find "/Library/Java/JavaVirtualMachines" -mindepth 1 -maxdepth 1 -print0 | \
xargs -0 -n 1 -I ^ jenv add "^/Contents/Home"
echo
echo "jenv versions # new"
jenv versions
echo
echo "jenv doctor"
jenv doctor
echo "jenv_reset END"
}
brew install --yes jenv
mkdir -p "${HOME}/.jenv/versions"
brew install --cask --yes \
"temurin@17" \
"temurin@21"
init_jenv
jenv_reset