Top.Mail.Ru
February 20th, 2009 - Java developers — LiveJournal
? ?

Java developers

February 20th, 2009
Image

03:30 pm - Imagebanana - JNLP woe

I'm having trouble with JNLP.

I build a jar file and sign it, then I test it from the command line: java -classpath myapp.jar MyApp. Everything works.

Now I run it from a browser via a JNLP file and it fails. The Java console says: Cut for wide-nessCollapse ) That last class is mine, suggesting that it's managed to parse the JNLP file, download the jar and load my classes. But the app has died while trying to read an XML file. The XML is definitely inside the jar - if it weren't, the app wouldn't have worked from the command line.

The relevant line is trying to read a stream opened with ClassLoader.getSystemResourceAsStream - is this the wrong way to open a resource stream in a web-start app?

Edit: fixed it. MyClass.class.getClassLoader().getResourceAsStream works. Grr!
Powered by LiveJournal.com
Image