This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet classloader can't load Properties

 
Antonio Foglia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm developing an Applet that print a bar code using Jpos API. I need some jars and two configuration file. I've added jars to the classpath and configuration files in src directory. In Eclipse everything works fine.



Everything works fine in Eclispe but I can't find property files when i call the applet from a web page. So I've checked the JavaPos sources and I've paste the loadJposProperties() and xmlReg.load("wincor.jpos17.THxxx.xml") content in my source code:



The same method is used to found wincor.jpos17.THxxx.xml. So when I call applet form the browser I get INPUT STREAM FROM PROPERTIES OK!! from (1) and jpos/res/jpos.properties not found from (2).
So getClass().getClassLoader().getResourceAsStream works if i write it directly in my code, but doesn't work if i call a jar method.
I am really at a loss for what to try next in the debugging chain. Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So when I call applet form the browser I get INPUT STREAM FROM PROPERTIES OK!! from (1) and jpos/res/jpos.properties not found from (2).

Not knowing what prop.loadJposProperties() does, it's not possible to say why it behaves differently.

So getClass().getClassLoader().getResourceAsStream works if i write it directly in my code, but doesn't work if i call a jar method.

By "directly" you mean what you call "(1)", correct? What do you mean by "if i call a jar method"?
 
Antonio Foglia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prop.loadJposProperties() does



Yes, by "directly" i mean whe i call (1).
By "if i call a jar method" i mean call "prop.loadJposProperties()". Prop is a DefaultProperties object imported from an external jar. I've added alle xternal jar declarations to the jnlp file.
 
Tony Docherty
Bartender
Posts: 2989
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the Java console to see if any exceptions are being thrown?

BTW I suspect code 1 is not the complete equivalent of code 2. Code 1 just gets an input stream whereas code 2 almost certainly gets the input stream, reads it and creates some sort of property object. It may be one of the later stages of process 2 is failing for example due to a lack of read permissions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic