support de java 8
This commit is contained in:
parent
d33bc3c0fd
commit
abd0d119ac
|
@ -1 +1 @@
|
|||
007002000
|
||||
007003000
|
||||
|
|
|
@ -13,16 +13,19 @@ JAVA_VMS14=(); JAVA_HOMES14=()
|
|||
JAVA_VMS5=(); JAVA_HOMES5=()
|
||||
JAVA_VMS6=(); JAVA_HOMES6=()
|
||||
JAVA_VMS7=(); JAVA_HOMES7=()
|
||||
JAVA_VMS8=(); JAVA_HOMES8=()
|
||||
# versions locales 32 bits
|
||||
JAVA32_VMS13=(); JAVA32_HOMES13=()
|
||||
JAVA32_VMS14=(); JAVA32_HOMES14=()
|
||||
JAVA32_VMS5=(); JAVA32_HOMES5=()
|
||||
JAVA32_VMS6=(); JAVA32_HOMES6=()
|
||||
JAVA32_VMS7=(); JAVA32_HOMES7=()
|
||||
JAVA32_VMS8=(); JAVA32_HOMES8=()
|
||||
# versions locales 64 bits
|
||||
JAVA64_VMS5=(); JAVA64_HOMES5=()
|
||||
JAVA64_VMS6=(); JAVA64_HOMES6=()
|
||||
JAVA64_VMS7=(); JAVA64_HOMES7=()
|
||||
JAVA64_VMS8=(); JAVA64_HOMES8=()
|
||||
# version sélectionnée
|
||||
SELECTED_JAVA_VM=; SELECTED_JAVA_HOME=
|
||||
SELECTED_JAVA=; SELECTED_JAVAC=
|
||||
|
@ -34,7 +37,7 @@ function __java_add() {
|
|||
|
||||
function __java_compute_vms() {
|
||||
# calculer la liste de VMs disponibles et initialiser les tableaux
|
||||
# JAVA{,32,64}_{VMS,HOMES}{13,14,5,6,7}
|
||||
# JAVA{,32,64}_{VMS,HOMES}{13,14,5,6,7,8}
|
||||
[ -z "$__COMPUTED_JAVA_VMS" ] || return
|
||||
|
||||
local vms vm v
|
||||
|
@ -56,6 +59,9 @@ function __java_compute_vms() {
|
|||
elif [ "$v" == 1.7 ]; then
|
||||
__java_add VMS7 "$vm" 32
|
||||
__java_add HOMES7 "$HOME/opt/jvm32/$vm" 32
|
||||
elif [ "$v" == 1.8 ]; then
|
||||
__java_add VMS8 "$vm" 32
|
||||
__java_add HOMES8 "$HOME/opt/jvm32/$vm" 32
|
||||
fi
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt/jvm32" "j2sdk1.4.2*" | LANG=C sort -r)"
|
||||
|
@ -78,6 +84,11 @@ function __java_compute_vms() {
|
|||
__java_add VMS7 "$vm" 32
|
||||
__java_add HOMES7 "$HOME/opt/jvm32/$vm" 32
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt/jvm32" "jdk1.8.*" | LANG=C sort -r)"
|
||||
for vm in "${vms[@]}"; do
|
||||
__java_add VMS8 "$vm" 32
|
||||
__java_add HOMES8 "$HOME/opt/jvm32/$vm" 32
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt/jvm64" "sun-jdk-*")"
|
||||
for vm in "${vms[@]}"; do
|
||||
v="${vm#sun-jdk-}"
|
||||
|
@ -90,6 +101,9 @@ function __java_compute_vms() {
|
|||
elif [ "$v" == 1.7 ]; then
|
||||
__java_add VMS7 "$vm" 64
|
||||
__java_add HOMES7 "$HOME/opt/jvm64/$vm" 64
|
||||
elif [ "$v" == 1.8 ]; then
|
||||
__java_add VMS8 "$vm" 64
|
||||
__java_add HOMES8 "$HOME/opt/jvm64/$vm" 64
|
||||
fi
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt/jvm64" "jdk1.5.*" | LANG=C sort -r)"
|
||||
|
@ -107,6 +121,11 @@ function __java_compute_vms() {
|
|||
__java_add VMS7 "$vm" 64
|
||||
__java_add HOMES7 "$HOME/opt/jvm64/$vm" 64
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt/jvm64" "jdk1.8.*" | LANG=C sort -r)"
|
||||
for vm in "${vms[@]}"; do
|
||||
__java_add VMS8 "$vm" 64
|
||||
__java_add HOMES8 "$HOME/opt/jvm64/$vm" 64
|
||||
done
|
||||
# Puis chercher dans les JVMs installées manuellement dans ~/opt
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt" "sun-jdk-*")"
|
||||
for vm in "${vms[@]}"; do
|
||||
|
@ -123,6 +142,9 @@ function __java_compute_vms() {
|
|||
elif [ "$v" == 1.7 ]; then
|
||||
__java_add VMS7 "$vm"
|
||||
__java_add HOMES7 "$HOME/opt/$vm"
|
||||
elif [ "$v" == 1.8 ]; then
|
||||
__java_add VMS8 "$vm"
|
||||
__java_add HOMES8 "$HOME/opt/$vm"
|
||||
fi
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt" "j2sdk1.4.2*" | LANG=C sort -r)"
|
||||
|
@ -145,6 +167,11 @@ function __java_compute_vms() {
|
|||
__java_add VMS7 "$vm"
|
||||
__java_add HOMES7 "$HOME/opt/$vm"
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "$HOME/opt" "jdk1.8.*" | LANG=C sort -r)"
|
||||
for vm in "${vms[@]}"; do
|
||||
__java_add VMS8 "$vm"
|
||||
__java_add HOMES8 "$HOME/opt/$vm"
|
||||
done
|
||||
# Puis chercher dans les JVMs installées manuellement dans /opt
|
||||
array_from_lines vms "$(list_dirs "/opt" "sun-jdk-*")"
|
||||
for vm in "${vms[@]}"; do
|
||||
|
@ -161,6 +188,9 @@ function __java_compute_vms() {
|
|||
elif [ "$v" == 1.7 ]; then
|
||||
__java_add VMS7 "$vm"
|
||||
__java_add HOMES7 "/opt/$vm"
|
||||
elif [ "$v" == 1.8 ]; then
|
||||
__java_add VMS8 "$vm"
|
||||
__java_add HOMES8 "/opt/$vm"
|
||||
fi
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "/opt" "j2sdk1.4.2*" | LANG=C sort -r)"
|
||||
|
@ -183,6 +213,11 @@ function __java_compute_vms() {
|
|||
__java_add VMS7 "$vm"
|
||||
__java_add HOMES7 "/opt/$vm"
|
||||
done
|
||||
array_from_lines vms "$(list_dirs "/opt" "jdk1.8.*" | LANG=C sort -r)"
|
||||
for vm in "${vms[@]}"; do
|
||||
__java_add VMS8 "$vm"
|
||||
__java_add HOMES8 "/opt/$vm"
|
||||
done
|
||||
# Puis chercher dans les JVMs installées par le système dans
|
||||
# /usr/lib/jvm
|
||||
if check_sysinfos -d gentoo; then
|
||||
|
@ -202,6 +237,9 @@ function __java_compute_vms() {
|
|||
elif [ "$v" == 1.7 ]; then
|
||||
__java_add VMS7 "$vm"
|
||||
__java_add HOMES7 "/usr/lib/jvm/$vm"
|
||||
elif [ "$v" == 1.8 ]; then
|
||||
__java_add VMS8 "$vm"
|
||||
__java_add HOMES8 "/usr/lib/jvm/$vm"
|
||||
fi
|
||||
done
|
||||
elif check_sysinfos -d debianlike; then
|
||||
|
@ -223,6 +261,9 @@ function __java_compute_vms() {
|
|||
elif [ "$v" == 7 -o "$v" == 1.7 ]; then
|
||||
__java_add VMS7 "$vm"
|
||||
__java_add HOMES7 "/usr/lib/jvm/$vm"
|
||||
elif [ "$v" == 8 -o "$v" == 1.8 ]; then
|
||||
__java_add VMS8 "$vm"
|
||||
__java_add HOMES8 "/usr/lib/jvm/$vm"
|
||||
fi
|
||||
done
|
||||
if [ -d /usr/lib/j2sdk1.4-sun ]; then
|
||||
|
@ -254,13 +295,17 @@ function __java_compute_vms() {
|
|||
__java_add VMS7 "1.7"
|
||||
__java_add HOMES7 "/System/Library/Frameworks/JavaVM.framework/Versions/1.7/Home"
|
||||
fi
|
||||
if [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/1.8" ]; then
|
||||
__java_add VMS8 "1.8"
|
||||
__java_add HOMES8 "/System/Library/Frameworks/JavaVM.framework/Versions/1.8/Home"
|
||||
fi
|
||||
fi
|
||||
__COMPUTED_JAVA_VMS=1
|
||||
}
|
||||
|
||||
function __java_dump_vms() {
|
||||
local v b i vms homes
|
||||
for v in 13 14 5 6 7; do
|
||||
for v in 13 14 5 6 7 8; do
|
||||
for b in "" 32 64; do
|
||||
vms="JAVA${b}_VMS${v}[@]"; vms=("${!vms}")
|
||||
homes="JAVA${b}_HOMES${v}[@]"; homes=("${!homes}")
|
||||
|
@ -291,7 +336,7 @@ function __java_select_vms() {
|
|||
}
|
||||
|
||||
function __java_select() {
|
||||
# Sélectionner la version de java $1 (qui peut être 13, 14, 5, 6 ou 7)
|
||||
# Sélectionner la version de java $1 (qui peut être 13, 14, 5, 6, 7 ou 8)
|
||||
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
||||
# version 32bits ou 64 bits. Sinon, la version sélectionnée peut être 32bits
|
||||
# ou 64bits selon ce qui est disponible.
|
||||
|
@ -335,7 +380,7 @@ function __java_select() {
|
|||
|
||||
function __java_select_default() {
|
||||
# Sélectionner la version de java par défaut. Si JAVA_HOME est défini,
|
||||
# prendre cette valeur. Sinon, essayer dans l'ordre 5, 6, 7, puis 14
|
||||
# prendre cette valeur. Sinon, essayer dans l'ordre 5, 6, 7, 8, puis 14
|
||||
# la version 13 n'est jamais sélectionnée automatiquement
|
||||
if [ -n "$JAVA_HOME" ]; then
|
||||
export JAVA_HOME # s'assurer que cette variable est exportée
|
||||
|
@ -347,7 +392,7 @@ function __java_select_default() {
|
|||
return 0
|
||||
fi
|
||||
local vm
|
||||
for vm in 5 6 7 14; do
|
||||
for vm in 5 6 7 8 14; do
|
||||
__java_select "$vm" && return 0
|
||||
done
|
||||
return 1
|
||||
|
@ -355,34 +400,39 @@ function __java_select_default() {
|
|||
|
||||
function select_java() {
|
||||
# sélectionner la version *minimum* de java correspondant à $1
|
||||
# $1== 1.3|1.3+|1.4|1.4+|1.5|1.5+|1.6|1.6+|1.7|1.7+
|
||||
# $1== 1.3|1.3+|1.4|1.4+|1.5|1.5+|1.6|1.6+|1.7|1.7+|1.8|1.8+
|
||||
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
||||
# version 32bits ou 64 bits
|
||||
local v vms homes
|
||||
|
||||
case "$1" in
|
||||
1.3|1.3+|13|13+)
|
||||
for v in 13 14 5 6 7; do
|
||||
for v in 13 14 5 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
1.4|1.4+|14|14+)
|
||||
for v in 14 5 6 7; do
|
||||
for v in 14 5 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
1.5|1.5+|5|5+)
|
||||
for v in 5 6 7; do
|
||||
for v in 5 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
1.6|1.6+|6|6+)
|
||||
for v in 6 7; do
|
||||
for v in 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
1.7|1.7+|7|7+)
|
||||
for v in 7; do
|
||||
for v in 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
1.8|1.8+|8|8+)
|
||||
for v in 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
|
@ -392,8 +442,8 @@ function select_java() {
|
|||
|
||||
function select_java_exact() {
|
||||
# sélectionner la version *exacte* de java correspondant à $1
|
||||
# $1== 1.3|1.4|1.5|1.6|1.7 pour une correspondance exacte
|
||||
# $1== 1.3+|1.4+|1.5+|1.6+|1.7+ pour une version minimum
|
||||
# $1== 1.3|1.4|1.5|1.6|1.7|1.8 pour une correspondance exacte
|
||||
# $1== 1.3+|1.4+|1.5+|1.6+|1.7+|1.8+ pour une version minimum
|
||||
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
||||
# version 32bits ou 64 bits
|
||||
local v vms homes
|
||||
|
@ -403,7 +453,7 @@ function select_java_exact() {
|
|||
__java_select 13 && return 0
|
||||
;;
|
||||
1.3+|13+)
|
||||
for v in 13 14 5 6 7; do
|
||||
for v in 13 14 5 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
|
@ -411,7 +461,7 @@ function select_java_exact() {
|
|||
__java_select 14 && return 0
|
||||
;;
|
||||
1.4+|14+)
|
||||
for v in 14 5 6 7; do
|
||||
for v in 14 5 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
|
@ -419,7 +469,7 @@ function select_java_exact() {
|
|||
__java_select 5 "$2" && return 0
|
||||
;;
|
||||
1.5+|5+)
|
||||
for v in 5 6 7; do
|
||||
for v in 5 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
|
@ -427,7 +477,7 @@ function select_java_exact() {
|
|||
__java_select 6 "$2" && return 0
|
||||
;;
|
||||
1.6+|6+)
|
||||
for v in 6 7; do
|
||||
for v in 6 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
|
@ -435,7 +485,15 @@ function select_java_exact() {
|
|||
__java_select 7 "$2" && return 0
|
||||
;;
|
||||
1.7+|7+)
|
||||
for v in 7; do
|
||||
for v in 7 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
1.8|8)
|
||||
__java_select 8 "$2" && return 0
|
||||
;;
|
||||
1.8+|8+)
|
||||
for v in 8; do
|
||||
__java_select "$v" "$2" && return 0
|
||||
done
|
||||
;;
|
||||
|
@ -447,9 +505,9 @@ function select_java_any() {
|
|||
# Sélectionner la version exacte de java correspondant aux arguments, dans
|
||||
# l'ordre, jusqu'à ce qu'un argument corresponde. DEFAULT correspond à la
|
||||
# valeur actuelle de JAVA_HOME, si elle est définie.
|
||||
# Si aucun argument n'est défini, on assume "DEFAULT 1.5 1.6 1.7 1.4"
|
||||
# Si aucun argument n'est défini, on assume "DEFAULT 5 6 7 8 1.4"
|
||||
local v
|
||||
[ -n "$*" ] || set -- DEFAULT 5 6 7 1.4
|
||||
[ -n "$*" ] || set -- DEFAULT 5 6 7 8 1.4
|
||||
for v in "$@"; do
|
||||
if [ "$v" == DEFAULT ]; then
|
||||
if [ -n "$JAVA_HOME" ]; then
|
||||
|
|
Loading…
Reference in New Issue