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