0

When I run a method on my application, I get the following exception, but the class that is miss 'JarSignerResources' is in my classpath (part of tools.jar). I have never seen an exception like this before, and it only occurs on Linux (not OSX). Can anyone give me a bit of insight into why this would be happening? Thanks.

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

This happens at this point in the code:

public static void signJar(String keystore, String keystorePassword, String jarFile, String alias) throws Exception{
    JarSigner js = new JarSigner();
    js.signJar(keystore, keystorePassword, jarFile, alias);
}
wuntee
  • 12,170
  • 26
  • 77
  • 106

1 Answers1

2

The sun.* packages are not part of the supported, public interface. It is likely you are not using a sun jdk on linux.

A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.

see here for details

Paul Whelan
  • 16,574
  • 12
  • 50
  • 83
  • Whats the output of java -version? – Paul Whelan Oct 07 '11 at 14:12
  • ah, that make sense. so, i guess my next question would be, how do you programmatically sign a jar file? it doesnt seem like its possible without using some sun.* packages... i guess ill have to open a new thread on that. thanks. – wuntee Oct 07 '11 at 14:21
  • java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing) – wuntee Oct 07 '11 at 14:21