This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

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

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • 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?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about this:

 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!