• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to read properties file from different package

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have properties file which is in different package from where i want to access

below code does not works..can any one please help


InputStream in = getClass().getResourceAsStream("/Test/bin/test.properties");

FileInputStream fis = new FileInputStream("/Test/bin/test.properties");

props.load(fis);

Thanks in Advance !!
 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi AMi,

This should work
Properties props = new Properties();
props.load(getClass().getClassLoader().getResourceAsStream("test2/test2.properties"));
System.out.println(":::::"+keyfromtheprofile);
Regards
Jatan
 
reply
    Bookmark Topic Watch Topic
  • New Topic