Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Detect if a .properties file is in a jar  RSS feed

 
Chris Grimble
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it possible to detect if a .properties file is being loaded from inside a jar file.

I have a class that loads a bean from a .properties file and then sets up a listener to reload the bean if it changes. If the .properties file is in a jar then the listener is of no use and I want to try and detect this from within my code.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NOTE, I haven't tried this myself but, you are more than likely using ClassLoader.getResourceAsStream to load that properties file. You can also use ClassLoader.findResource to get the URL and see if it is a jar url or a file url.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!