• Post Reply Bookmark Topic Watch Topic
  • New Topic

JAR + Properties  RSS feed

 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a class that load a .properties file, but this file will be out of jar. How to load
My application will be in c:\App\App.jar and my propertie c:\App\Conf.properties
how to load on my class?
I try load(getClass().getResourceAsStream("Conf.properties")) but dont work.
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To use the getResource* methods, the resource (i.e., the properties file) has to be loaded from the same place as the class. Generally people put the properties file in the JAR itself. Otherwise, if you can't do this, then you'll need to load the properties file using an explicit FileInputStream.
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!