Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9055991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:05:09+00:00 2026-06-16T14:05:09+00:00

I have an EJB 2.1 application that refers to a properties file to read

  • 0

I have an EJB 2.1 application that refers to a properties file to read a value from. The filename of the properties file is defined as

private static final String CONFIG_DIRECTORY = "config.";
private static final String PROPERTIES_FILE = CONFIG_DIRECTORY + "myapp";

To load and read the property from the properties file, the following call is made passing in PROPERTIES_FILE as the name of the propertyFileName

this.getProperties(PROPERTIES_FILE);

The getProperties method uses ResourceBundle to load the properties file as shown below.

public Properties getProperties (String propertyFileName) {
        Properties properties = new Properties();
        ResourceBundle resourceBundle = ResourceBundle.getBundle(propertyFileName);
        Enumeration<String> keys = resourceBundle.getKeys();

        while (keys.hasMoreElements()) {
            String key = (String)keys.nextElement();
            String value = resourceBundle.getString(key);
            properties.put(key, value);
        }
        return properties;
    }

Now i have spent ages trying to find a file called config.myapp everywhere within the application’s file system but it does not exist. I even searched the whole filesystem for that file but it is not there. I looked inside all the folders, jar files etc but i cannot find a file called config.myapp

There is a folder called ‘config’ in the root directory of the application and within that folder there is a file called myapp.properties which does have the property that is being read by the application. Could it be be that config.myapp is actually referring to the config/myapp.properties file? If so how does that work? Does ResourceBundle somehow translate config.myapp to config/myapp.properties?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:05:11+00:00Added an answer on June 16, 2026 at 2:05 pm

    Replacing the dots with slashes and appending .properties is the expected behavior. From the docs for ResourceBundle.getBundle:

    Otherwise, getBundle attempts to locate a property resource file. It
    generates a path name from the candidate bundle name by replacing all
    “.” characters with “/” and appending the string “.properties”. It
    attempts to find a “resource” with this name using
    ClassLoader.getResource.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an application on Glassfish 3. I have an EJB that looks like
I have a JSF application that, in a managed bean, calls business logic from
I have a JavaEE application that needs to access a file in order to
As shown in the above pic, I have a EJB-3 Enterprise application (EAR file),
I have a large application that uses EJB 2.x entity beans (BMP). This is
I have application packed as an .ear file with ejb module inside. There is
I'm using an application with EJB and CMT transactions. I have an EJB (let´s
I have an application (CC) containing two modules: CC-ejb and CC-war. CC-ejb contains JPA
I have a JEE6 application, with an ejb and a web-module, running on a
i have created a demo application Using JSF & EJB 3.0 (Stateless session bean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.