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

  • Home
  • SEARCH
  • 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 8280357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:38:57+00:00 2026-06-08T09:38:57+00:00

Please tell me where exactly do i put my .properties file in my eclipse

  • 0

Please tell me where exactly do i put my .properties file in my eclipse project. Do I make a separate folder for it ?
I want to put it in such a way that I will be able to distribute my project easily in JAR form.

Thanks.

EDIT:

I want to put the properties file in such a way that it can be easily edited later, on any OS.

  • 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-08T09:38:59+00:00Added an answer on June 8, 2026 at 9:38 am

    The approach I use in order to be able to easily change configuration without redeployment.

    One version of the property file (with the defaults) in the root of your project, I always let it in the application package (foo.bar.myapp). I load the default one with getResourceAsStream("/foo/bar/myapp/config.properties") or like in the sample relative to the class package.

    And additionally I ready a system property:

    String configFileLocation = System.getProperty("config");
    

    And just override the default with the properties read from the config file passed as property.

    For instance:

    Properties props = new Properties();
    props.load(Main.class.getResourceAsStream("mydefault.properties"));
    
    System.out.println("default loaded: " + props);
    
    String configFile = System.getProperty("config");
    if (configFile != null) {
        props.load(new FileInputStream(configFile));
        System.out.println("custom config loaded from " + configFile);
    }
    
    System.out.println("custom override: " + props);
    

    This would load first your resource stored under your project in foo.bar package named mydefault.properties, and after it if system property config is configured it will load override the loaded properties with the one the the referred path.

    The system property can be set using -D parameter, in this case would be something like: java -Dconfig=/home/user/custom.properties foo.bar.Main. Or if you are in a web application (Tomcat for instance) you can set this property using CATALINA_OPTS.

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

Sidebar

Related Questions

Could someone please tell me what is exactly wrong with the way my case
Can some one please tell me why exactly classes were introduced in C++. Are
Please tell me why my window doesn't render. Below is the javascript that i
Can anyone please tell me what exactly this script does? #! /bin/sh test –f
please someone tell me how to make standalone applications in C++ Builder, without runtime
Can someone please tell me how exactly to use getExtra() and putExtra() for intents?
Could you please tell me what is UTC time exactly... I'm currently developing a
Can anyone please tell me, what exactly is meant by registering a callback function
Can someone please tell me the difference exactly between these 2 RegEx's? '/[^a-zA-Z0-9\s]/' and
Can anybody please tell me what the Constructors are used for exactly in Java?

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.