Mercurial > hg > release > icedtea-web-1.8
changeset 1507:e7e17fa6a127
Added eternal java version detection
* acinclude.m4: used sophisticated head-cut to determine single number major java version
* plugin/icedteanp/IcedTeaNPPlugin.cc: similar
* shell-launcher/launchers.sh.in: same
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Mon, 01 Oct 2018 19:04:14 +0200 |
parents | 61cfcf1170a5 |
children | 31043cd51d7f |
files | ChangeLog acinclude.m4 plugin/icedteanp/IcedTeaNPPlugin.cc shell-launcher/launchers.sh.in |
diffstat | 4 files changed, 32 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Sep 05 23:13:59 2018 +0100 +++ b/ChangeLog Mon Oct 01 19:04:14 2018 +0200 @@ -1,3 +1,10 @@ +2018-10-01 Fridrich Strba <fridrich.strba@suse.com> + + Added eternal java version detection + * acinclude.m4: used sophisticated head-cut to determine single number major java version + * plugin/icedteanp/IcedTeaNPPlugin.cc: similar + * shell-launcher/launchers.sh.in: same + 2018-09-05 Jiri Vanek <jvanek@redhat.com> * shell-launcher/launchers.sh.in: inverted logic to detect modular jdk.
--- a/acinclude.m4 Wed Sep 05 23:13:59 2018 +0100 +++ b/acinclude.m4 Mon Oct 01 19:04:14 2018 +0200 @@ -795,10 +795,16 @@ [ AC_REQUIRE([IT_FIND_JAVA]) AC_MSG_CHECKING([JDK version]) - JAVA_VERSION=`$JAVA -version 2>&1` + JAVA_VERSION=`$JAVA -version 2>&1 | head -n 1 | cut -d'-' -f1 | cut -d'"' -f2 | cut -d'.' -f1` + if test "${JAVA_VERSION}" -eq "1"; then + JAVA_VERSION=`$JAVA -version 2>&1 | head -n 1 | cut -d'-' -f1 | cut -d'"' -f2 | cut -d'.' -f2` + fi AC_MSG_RESULT($JAVA_VERSION) - HAVE_JAVA8=`if echo $JAVA_VERSION | grep -q -e 1.8.0 ; then echo yes ; fi` - HAVE_JAVA9=`if echo $JAVA_VERSION | grep -q -e 1.9.0 -e \"9 -e "build 9" ; then echo yes ; fi ` + if test "${JAVA_VERSION}" -eq "8"; then + HAVE_JAVA8="yes" + elif test "$JAVA_VERSION" -ge "9"; then + HAVE_JAVA9="yes" + fi if test -z "$HAVE_JAVA8" -a -z "$HAVE_JAVA9"; then AC_MSG_ERROR([JDK8 or newer is required, detected was: $JAVA_VERSION]) fi
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc Wed Sep 05 23:13:59 2018 +0100 +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc Mon Oct 01 19:04:14 2018 +0200 @@ -1562,11 +1562,15 @@ command_line[2] = NULL; if ( standard_error != NULL ){ - if(strstr(standard_error, "\"9") != NULL) { - PLUGIN_DEBUG ("detected 9\n"); - PLUGIN_DEBUG ("plugin_get_java_version return\n"); - return 9; - } + int major = 0; + int minor = 0; + sscanf(standard_error, "%*s %*s \"%d.%d", &major, &minor); + if (major == 1) + major = minor; + + PLUGIN_DEBUG ("detected version %d\n", major); + PLUGIN_DEBUG ("plugin_get_java_version return\n"); + return major; } PLUGIN_DEBUG ("detected 8 (or generally non nine)\n"); PLUGIN_DEBUG ("plugin_get_java_version return\n");
--- a/shell-launcher/launchers.sh.in Wed Sep 05 23:13:59 2018 +0100 +++ b/shell-launcher/launchers.sh.in Mon Oct 01 19:04:14 2018 +0200 @@ -37,9 +37,13 @@ LAUNCHER_BOOTCLASSPATH="$LAUNCHER_BOOTCLASSPATH:@JRE@/$NASHORN" fi; -MODULAR_JDK="YES" -if ${JAVA} -version 2>&1 | grep -q "version \"1.8.0" ; then - MODULAR_JDK="NO" +MODULAR_JDK="NO" +version=`${JAVA} -version 2>&1 | head -n 1 | cut -d'-' -f1 | cut -d'"' -f2 | cut -d'.' -f1` +if [ $version -eq "1" ]; then + version=`${JAVA} -version 2>&1 | head -n 1 | cut -d'-' -f1 | cut -d'"' -f2 | cut -d'.' -f2` +fi +if [ $version -ge "9" ]; then + MODULAR_JDK="YES" fi JAVA_ARGS=( )