0

当我在我的应用程序上运行一个方法时,我得到以下异常,但是缺少“JarSignerResources”的类在我的类路径中(tools.jar 的一部分)。我以前从未见过这样的异常,它只发生在 Linux(而不是 OSX)上。谁能给我一些关于为什么会发生这种情况的见解?谢谢。

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.ExceptionInInitializerError
    at com.wuntee.aat.smali.SmaliWorkshop.signJar(SmaliWorkshop.java:214)
    at com.wuntee.aat.smali.SmaliController.rebuildAndSignApk(SmaliController.java:223)
    at com.wuntee.aat.view.Gui$13.widgetSelected(Gui.java:354)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at com.wuntee.aat.view.Gui.open(Gui.java:135)
    at com.wuntee.aat.view.Gui$1.run(Gui.java:112)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at com.wuntee.aat.view.Gui.main(Gui.java:108)
    ... 5 more
Caused by: java.util.MissingResourceException: Can't find bundle for base name sun.security.tools.JarSignerResources, locale en_US
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:705)
    at com.wuntee.aat.security.tools.JarSigner.<clinit>(JarSigner.java:96)
    ... 17 more

这发生在代码中的这一点:

public static void signJar(String keystore, String keystorePassword, String jarFile, String alias) throws Exception{
    JarSigner js = new JarSigner();
    js.signJar(keystore, keystorePassword, jarFile, alias);
}
4

1 回答 1

2

sun.* 包不是受支持的公共接口的一部分。您可能没有在 linux 上使用 sun jdk。

不保证直接调用 sun.* 包的 Java 程序可以在所有 Java 兼容平台上运行。事实上,即使在同一平台上的未来版本中,也不能保证这样的程序可以正常工作。

详情见这里_

于 2011-10-07T14:00:58.133 回答