在将jnlp从openjdk 8迁移到openjdk 9时,JarIndexAccess无法访问类jdk.internal.util.jar.JarIndex(在java.base模块中)

时间:2019-01-09 07:11:18

标签: java jnlp java-9 icedtea

我们在jnlp下面

<?xml version="1.0" encoding="UTF-8"?>
<!-- !DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd" -->
<jnlp spec="6.0+" codebase="$$codebase" href="$$name">
<information>
  <title>Softpaint</title>
  <vendor>Advanced Business Solutions</vendor>
  <homepage href="$$name" />
  <description>Softpaint</description>
  <offline-allowed/>
</information>

<security> 
   <all-permissions/> 
</security>
<resources>
  <property name="jnlp.packEnabled" value="true"/>
  <j2se version="9+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="-ea 
  --add-opens=java.base/java.lang.reflect=ALL-UNNAMED
  --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED
  --add-opens=java.base/sun.misc=ALL-UNNAMED 
  --add-opens=java.base/jdk.internal.util.jar=ALL-UNNAMED"
  initial-heap-size="128m" max-heap-size="512m" />
  <j2se version="1.8+" max-heap-size="256m">
    <resources>
      <jar href="rtwrapper.jar"/>
    </resources>
  </j2se>
  <j2se version="1.7*" max-heap-size="256m"/>  
  <jar href="e5wui-icons.jar" download="eager"/>
  <jar href="wuipsp.jar" main="true"/>
  <jar href="wuicli.jar"/>
  <jar href="wuiclires.jar"/>
  <jar href="wuisrv.jar"/>
  <jar href="wuitools.jar"/>
  <jar href="e5h5cli.jar"/>
  <package name="oracle.*" part="oracleoracle" recursive="true"/>
  <jar href="ojdbc6.jar" part="oracleoracle" download="lazy"/>
  <jar href="orai18n.jar" part="oracleoracle" download="lazy"/>
  <package name="com.ibm.db2.*" part="ibmdb2" recursive="true"/>
  <jar href="db2jcc4.jar" part="ibmdb2" download="lazy"/>
  <jar href="db2jcc_license_cisuz.jar" part="ibmdb2" download="lazy"/>
  <package name="com.microsoft.sqlserver.*" part="mssql" recursive="true"/>
  <jar href="sqljdbc4.jar" part="mssql" download="lazy"/>
  <package name="org.postgresql.*" part="postgresql" recursive="true"/>
  <jar href="postgresql-9.3-1101-jdbc41.jar" part="postgresql" download="lazy"/>
  <jar href="tools.jar"/>
  <jar href="slf4j-api.jar"/>
  <jar href="slf4j-jdk14.jar"/>
  <jar href="jcl-over-slf4j.jar"/>
  <jar href="swingx.jar"/>
</resources>
<application-desc 
    main-class="com.cedar.softpaint.ui.PersonalSoftpaint"/>
</jnlp>

在jnlp上可以与Oracle jdk 8正常工作。现在,我们正在迁移到openjdk 9,并使用icetea web在客户端上打开jnlp文件。添加了带有一些Java参数的j2se version =“ 9+”,但由于未找到sun / misc / JarIndex类而面临以下问题。我知道该类已从openjdk 9中删除。那么是我们需要使用其他替代方法还是解决方法?

Activate native: http://mahesh-pc:7050/e5softpaint/e5wui-icons.jar
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 @3b938003     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 @3b938003     at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)     at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:589)     at java.base/java.lang.reflect.Method.invoke(Method.java:556)     at net.sourceforge.jnlp.jdk89acesses.JarIndexAccess.getJarIndexImpl(JarIndexAccess.java:53)     at net.sourceforge.jnlp.jdk89acesses.JarIndexAccess.getJarIndex(JarIndexAccess.java:45)     ... 12 more 
Running jdk9+ ?
java.lang.ClassNotFoundException: sun/misc/JarIndex     at java.base/java.lang.Class.forName0(Native Method)     at java.base/java.lang.Class.forName(Class.java:292)     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)

1 个答案:

答案 0 :(得分:0)

JarIndex was moved in Java 9 to internal package dk.internal.util.jar.JarIndex

后的代码中的查找ID
  

-导入sun.misc.JarIndex;

     

+ import jdk.internal.util.jar.JarIndex;

由于JEP 260

  

sun.misc.JarIndex及其随附的InvalidJarIndexException不是“关键API”,如   JEP 260,因此应将它们从sun.misc中移出,并放在更合适的包装中   可以封装。