簡體   English   中英

在將jnlp從openjdk 8遷移到openjdk 9時,JarIndexAccess無法訪問類jdk.internal.util.jar.JarIndex(在java.base模塊中)

[英]JarIndexAccess cannot access class jdk.internal.util.jar.JarIndex (in module java.base) in migrating jnlp from openjdk 8 to openjdk 9

我們有下面的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)

JarIndex在Java 9中移至內部包dk.internal.util.jar.JarIndex

-導入sun.misc.JarIndex;

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

由於JEP 260

如JEP 260所定義,sun.misc.JarIndex及其隨附的InvalidJarIndexException不是“關鍵API”,因此應將它們從sun.misc中移出,並放入更合適的包裝中以對其進行封裝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM