This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
    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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Can't use properties file in EJB project developed in WSAD

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am developing an EJB project in WSAD in which I have created a source folder storing all config. and properties files (I have examined the exported EAR file that it cantined these files). However, I found the EJB cannot locate the file. Shown below are the code snippet of loading the properties file "app.properties" with different approaches but all failed:

// Approach 1
final ResourceBundle rb = ResourceBundle.getBundle ("app.properties");

// Approach 2
final ResourceBundle rb = ResourceBundle.getBundle ("/app.properties");

// Approach 3
final ResourceBundle rb = ResourceBundle.getBundle ("app.properties",Locale.getDefault (), ClassLoader.getSystemClassLoader ());

// Approach 4
final ResourceBundle rb = ResourceBundle.getBundle ("/app.properties",Locale.getDefault (), ClassLoader.getSystemClassLoader ());

What's the problem? How can I solve it?
 
author & internet detective
Posts: 39396
763
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question in multiple threads. I'll close this one for you.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!