IcedTea-Web & Java 11

Laurent Bourgès bourges.laurent at gmail.com
Thu Aug 30 13:05:26 UTC 2018


Hi,
I am testing too icedTea-web 1.7 (hg) with openjdk 11 !
It does not work out of the box, notably I had to hack shell scripts so I
will propose patches soon.

On linux, here are my changes to provide jigsaw CLI arguments:
JDK9="YES"
#if ${JAVA} -version 2>&1 | grep -q "version \"9-" ; then
#  JDK9="YES"
#fi

Hope it helps,
Laurent

PS: Here is my complete script (with my own install dirs & jdk11):
#!/bin/bash

NASHORN=lib/ext/nashorn.jar
JAVA=/home/bourgesl/apps/openjdk-11+28_linux-x64_bin/bin/java
LAUNCHER_BOOTCLASSPATH='-Xbootclasspath/a:/home/bourgesl/libs/icedtea-web-1.7/install/share/icedtea-web/netx.jar'
LAUNCHER_FLAGS=-Xms8m
CLASSNAME=net.sourceforge.jnlp.runtime.Boot
BINARY_LOCATION=/home/bourgesl/libs/icedtea-web-1.7/install/bin/javaws11
SPLASH_LOCATION=/home/bourgesl/libs/icedtea-web-1.7/install/share/icedtea-web/javaws_splash.png
PROGRAM_NAME=javaws

CONFIG_HOME=$XDG_CONFIG_HOME
if [ "x$CONFIG_HOME" = "x" ] ; then
  CONFIG_HOME=~/.config
fi;
PROPERTY_NAME=deployment.jre.dir
CUSTOM_JRE_REGEX="^$PROPERTY_NAME *= *"
CUSTOM_JRE=`grep "$CUSTOM_JRE_REGEX"
$CONFIG_HOME/icedtea-web/deployment.properties 2>/dev/null |  sed
"s/$CUSTOM_JRE_REGEX//g"`
#now check in legacy one
if [ "x$CUSTOM_JRE" = "x" ] ; then
  CUSTOM_JRE=`grep "$CUSTOM_JRE_REGEX" ~/.icedtea/deployment.properties
2>/dev/null |  sed "s/$CUSTOM_JRE_REGEX//g"`
fi;
#now check in global one
if [ "x$CUSTOM_JRE" = "x" ] ; then
  CUSTOM_JRE=`grep "$CUSTOM_JRE_REGEX"
/etc/.java/.deploy/deployment.properties 2>/dev/null |  sed
"s/$CUSTOM_JRE_REGEX//g"`
fi;
if [ "x$CUSTOM_JRE" != "x" ] ; then
  if [ -e  "$CUSTOM_JRE" -a -e "$CUSTOM_JRE/bin/java" ] ; then
    JAVA=$CUSTOM_JRE/bin/java
  else
    echo "Your custom JRE $CUSTOM_JRE read from deployment.properties under
key $PROPERTY_NAME as $CUSTOM_JRE is not valid. Using default ($JAVA) in
attempt to start. Please fix this."
  fi
fi;

JDK9="YES"
#if ${JAVA} -version 2>&1 | grep -q "version \"9-" ; then
#  JDK9="YES"
#fi

JAVA_ARGS=( )
ARGS=( )
COMMAND=()

i=0
j=0

SPLASH="false"
if [ "x$ICEDTEA_WEB_SPLASH" = "x" ] ; then
SPLASH="true"
fi;
while [ "$#" -gt "0" ]; do
  case "$1" in
    -J*)
      JAVA_ARGS[$i]="${1##-J}"
      i=$((i+1))
      ;;
    *)
      ARGS[$j]="$1"
      j=$((j+1))
      if [[ "$1" =~ ^[-]*headless ]] ; then
        SPLASH="false"
      fi
      ;;
  esac
  shift
done

k=0
COMMAND[k]="${JAVA}"
k=$((k+1))
if [ "$SPLASH" = "true" ] ; then
COMMAND[k]="-splash:${SPLASH_LOCATION}"
k=$((k+1))
fi;
COMMAND[k]="${LAUNCHER_BOOTCLASSPATH}"
k=$((k+1))
COMMAND[k]="${LAUNCHER_FLAGS}"
k=$((k+1))

if [ "x$JDK9" == "xYES" ] ; then
COMMAND[k]="--patch-module"
k=$((k+1))
COMMAND[k]="java.desktop=:/home/bourgesl/libs/icedtea-web-1.7/install/share/icedtea-web/netx.jar"
k=$((k+1))
# jsobject must be pathched separately from plugin
# otherwise netscape pkg would be shared by two modules, which is forbiden
JSOBJECT_JAR=
# plugin jar may not be built
if [ ! "x$JSOBJECT_JAR" == "x" ] ; then
  COMMAND[k]="--patch-module"
  k=$((k+1))
  COMMAND[k]="jdk.jsobject=$JSOBJECT_JAR"
  k=$((k+1))
fi

COMMAND[k]="--add-reads"
k=$((k+1))
COMMAND[k]="java.base=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-reads"
k=$((k+1))
COMMAND[k]="java.desktop=ALL-UNNAMED,java.naming"
k=$((k+1))
COMMAND[k]="--add-reads"
k=$((k+1))
COMMAND[k]="java.naming=ALL-UNNAMED,java.desktop"
k=$((k+1))

COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.desktop/sun.awt=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.desktop/javax.jnlp=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/sun.security.provider=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/sun.security.util=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/sun.security.x509=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/jdk.internal.util.jar=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/sun.security.validator=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/sun.net.www.protocol.jar=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.desktop/sun.awt.X11=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.naming/com.sun.jndi.toolkit.url=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.desktop/sun.applet=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/sun.security.action=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.base/sun.net.www.protocol.http=ALL-UNNAMED,java.desktop"
k=$((k+1))
COMMAND[k]="--add-exports"
k=$((k+1))
COMMAND[k]="java.desktop/sun.applet=ALL-UNNAMED,jdk.jsobject"
k=$((k+1))
fi


i=0
while [ "$i" -lt "${#JAVA_ARGS[@]}" ]; do
  COMMAND[k]="${JAVA_ARGS[$i]}"
  i=$((i+1))
  k=$((k+1))
done
#COMMAND[k]="-classpath"
#k=$((k+1))
#COMMAND[k]="${CP}"
#k=$((k+1))
COMMAND[k]="-Dicedtea-web.bin.name=${PROGRAM_NAME}"
k=$((k+1))
COMMAND[k]="-Dicedtea-web.bin.location=${BINARY_LOCATION}"
k=$((k+1))
COMMAND[k]="${CLASSNAME}"
k=$((k+1))
j=0
while [ "$j" -lt "${#ARGS[@]}" ]; do
  COMMAND[k]="${ARGS[$j]}"
  j=$((j+1))
  k=$((k+1))
done

echo "CLI: '${COMMAND[@]}' "
exec -a "$PROGRAM_NAME" "${COMMAND[@]}"

exit $?



Le jeu. 30 août 2018 à 12:36, Suewirotjanakun, Bundit <
bundit.suewirotjanakun at cgi.com> a écrit :

> Hello,
>
>
>
> First of all I’m sorry if I’m not using the discussion list properly. It’s
> my first time posting message to this mailing list.
>
>
>
> I’m trying to use IcedTea-Web 1.7.1 with Java 11, but I got the following
> error:
>
>
>
> java.lang.ClassNotFoundException: sun/misc/JarIndex
>
>       at java.base/java.lang.Class.forName0(Native Method)
>
>       at java.base/java.lang.Class.forName(Class.java:315)
>
>       at
> net.sourceforge.jnlp.jdk89acesses.JarIndexAccess.<clinit>(JarIndexAccess.java:23)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader$2.run(JNLPClassLoader.java:1340)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader$2.run(JNLPClassLoader.java:1232)
>
>       at java.base/java.security.AccessController.doPrivileged(Native
> Method)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.activateJars(JNLPClassLoader.java:1362)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:785)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.<init>(JNLPClassLoader.java:285)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.createInstance(JNLPClassLoader.java:357)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:429)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:403)
>
>       at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:809)
>
>       at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:529)
>
>       at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:940)
>
>
>
> Running jdk9+ ?
>
> java.lang.RuntimeException: java.lang.IllegalAccessException: class
> net.sourceforge.jnlp.jdk89acesses.JarIndexAccess cannot access class
> jdk.internal.util.jar.JarIndex (in module java.base) because module
> java.base does not export jdk.internal.util.jar to unnamed module @5906ebcb
>
>       at
> net.sourceforge.jnlp.jdk89acesses.JarIndexAccess.getJarIndex(JarIndexAccess.java:47)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader$2.run(JNLPClassLoader.java:1340)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader$2.run(JNLPClassLoader.java:1232)
>
>       at java.base/java.security.AccessController.doPrivileged(Native
> Method)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.activateJars(JNLPClassLoader.java:1362)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:785)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.<init>(JNLPClassLoader.java:285)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.createInstance(JNLPClassLoader.java:357)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:429)
>
>       at
> net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:403)
>
>       at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:809)
>
>       at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:529)
>
>       at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:940)
>
> Caused by: java.lang.IllegalAccessException: class
> net.sourceforge.jnlp.jdk89acesses.JarIndexAccess cannot access class
> jdk.internal.util.jar.JarIndex (in module java.base) because module
> java.base does not export jdk.internal.util.jar to unnamed module @5906ebcb
>
>       at
> java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
>
>       at
> java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
>
>       at java.base/java.lang.reflect.Method.invoke(Method.java:558)
>
>       at
> net.sourceforge.jnlp.jdk89acesses.JarIndexAccess.getJarIndexImpl(JarIndexAccess.java:53)
>
>       at
> net.sourceforge.jnlp.jdk89acesses.JarIndexAccess.getJarIndex(JarIndexAccess.java:45)
>
>       ... 12 more
>
>
>
> I kind of have good idea of what causes the error, but I just want to make
> sure that I explore all the options. Is there any configuration I can set
> to make it worked with Java 11? Do I have to wait for the a version of
> IcedTea-Web that supports Java 11? If it’s the case, is there any timeline
> on the GA?
>
>
>
> Thank you.
>
>
>
> Best regards,
>
> Bundit Suewirotjanakun.
>


-- 
-- 
Laurent Bourgès
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20180830/407540fb/attachment-0001.html>


More information about the distro-pkg-dev mailing list