我有一个应用程序,它只包含签名的 jar,所有这些都使用同一个证书,我的。我不想使用 Webstart 运行该应用程序。应用程序运行编译器,编译后的代码运行LWJGL。然而,当我运行该应用程序时,它会通过编译的代码返回错误,它实际上无法找到 LWJGL(-library) 包(原始应用程序可以很好地看到它)。当我将应用程序编译为可信库时,它也会出错:
Exception in thread "CompilerThread" java.lang.NoClassDefFoundError: com/sun/tools/javac/api/JavacTool
at customcompile.CustomCompile$2.run(CustomCompile.java:82)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.api.JavacTool
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
http://download.oracle.com/javase/6/docs/technotes/guides/jweb/mixed_code.html 我找到了这个网站,但它并没有让我对特定主题更加明智,因为它显然与编译代码的处理方式与其他代码不同有关。
有人可以帮我解决这个问题吗?还是把它清理掉?
编辑:我得出的结论是编译后的代码被视为未签名。 要使库被识别,需要将它们添加到类路径中。
最佳答案
我认为将 System.getProperty 调用等重定向到已签名的类,将解决未签名代码中的任何问题,从而间接赋予其更多权限。
关于java - Webstart 和 JavaCompiler API 限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7167806/