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 8816331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:35:50+00:00 2026-06-14T04:35:50+00:00

In my Java EE web application, I need a place to put my properties

  • 0

In my Java EE web application, I need a place to put my properties file where I can find it using getResource() and then update that file.

Placing it in the lib directory doesn’t seem to have worked for tomcat. Suggestions?

The application is that GXT needs to have a properties file to hold internationalized strings. I have a requirement to load these strings from a database table. So I have to create the properties file on startup. I am creating an empty one that goes into my jar file in the lib directory. Then I find that file and write to it with the new answers. It all works in jetty, but not in tomcat.

Thanks.

  • 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-14T04:35:51+00:00Added an answer on June 14, 2026 at 4:35 am

    You can’t necessarily reliably write to a classpath location as it might not represent a local disk file system path. You can only write to a (absolute) disk file system location.

    Best would be to have a known fixed disk file system location which is in turn also added to the classpath, so that you could use both ClassLoader#getResource() to load it from the classpath and FileOutputStream to write it to the local disk file system.

    In case of Tomcat, you can add a fixed disk file system location to the classpath by the shared.loader property of /conf/catalina.properties. E.g.

    shared.loader = /var/webapp/conf
    

    It might be useful as well to add a property representing the fixed disk file system location to the properties file itself.

    my.location = /var/webapp/conf
    

    This way you can read it as

    Properties properties = new Properties();
    properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("foo.properties");
    

    And save as

    properties.store(new FileOutputStream(new File(properties.getProperty("my.location"), "foo.properties")));
    

    See also:

    • Where to place and how to read configuration resource files in servlet based application?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the java web application need to select the file from server and print
I am developing a Java Web Application using JSF, Spring and Hibernate. I need
I have a large Java Web Application project using Maven and I need to
I need to set up a logging system for my java web application that
I need to centralize all settings for our Java web application in one .properties
In my java web application i need to show the image that exits in
I have a java web application wired using Spring on Tomcat. I need a
I need to implement single sign-on in my java web application which can achieve
I'm going to develop a java web start application, which need to access protected
From a FreeMarker template in a Java EE web application, I need to access

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.