• 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

Loading properties file in WSAD 4.0.3

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been trying to load properties file into web app in WSAD using following code.
Properties p = new Properties();
InputStream i = Runtime.getRuntime().getClass().getResourceAsStream("connect.properties");
The location of the properties file is at Java source/connect.properties. When I try to load the properties file as above, I am getting null InputStream. I have tried to give absolute path to get to connect.properties with no success. The same code works fine in Eclipse but not in WSAD 4. May be I am missing some thing here! I would appreciate your help on this issue.
Thanks
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try refering to the file as /connect.properties
I always do this operation in two stages:
1. get the ClassLoader to load the file as a URL
(then test the URL is not null and is correct)
2. get a Stream from the URL.
Step one has bitten me too many times. :roll:
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic