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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:42:46+00:00 2026-06-05T13:42:46+00:00

My Java JSP application requires to store permanent files on the Tomcat web server.

  • 0

My Java JSP application requires to store permanent files on the Tomcat web server. At the moment I save the files in the “/temp” folder of the System. But this folder gets cleared from time to time. Further, the current solution is hard-coded which makes it less flexible (e.g. when moving to another server).

I would like to now if there is a best practice for defining and accessing a permanent directory in this configuration. In detail, where is the best place to define the app file directory, and how would I access this from within my java application? The goal of this setup would be to cause the least effort when (a) updating the application (i.e. placing a new war file), and (b) moving from one server to another and OS (e.g. Unix, Windows, MacOS).

The research I have done on this topic so far revealed that the following would be solutions (possibly amongst others):

1.) Use of a custom subdirectory in the Tomcat installation directory.

  • What happens to the files if I deploy a new version on the tomcat via
    war file?
  • Where do I define this directory to be accessed from
    within my Java application?

2.) In a separate directory in the file system.

  • Which are good locations or ways to get the locations without knowing
    the system?
  • Where do I define this directory to be accessed from
    within my Java application?

Thank you for your advice!

  • 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-05T13:42:47+00:00Added an answer on June 5, 2026 at 1:42 pm

    Essentially, you are creating ‘a database’ in the form of some files. In the world of Java EE and servlet containers, the only really general approach to this is to configure such a resource via JNDI. Tomcat and other containers have no concept of ‘a place for persistent storage for webapps’. If a webapp needs persistent storage, it needs to be configured via JNDI, or -D, or something you tell it by posting something to it. There’s no convention or standard practice you can borrow.

    You can pick file system pathname by convention and document that convention (e.g. /var/something on Linux, something similar on Windows). But you won’t necessarily be aligned with what anyone else is doing.

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

Sidebar

Related Questions

Hi I have a page in my java/jsp based web application which shows list
My web application is written using jsp/javascripts. Backend Java. Have managed to implement the
im planning to use java/jsp for web application installed on virtual web hosting space
i'm programing a java web application where some fields in jsp require specific characters
I'm working on an existing Java web application (HTML/CSS/JS/JSP/Servlets and Java classes in this
I am developing a web application using Java/JSP. One class, say Student, has a
In a tomcat JSP application I have this directory layout: webapps/ myProjectName/ index.jsp WEB-INF/
I have a decent working web application (Java/Servlet/Jsp) that I would like to improve
It is a JSP application. Under /WEB-INF/src I have A.java and B.java, both in
I am using JSP 2.1 in a Java EE web application. My JSP page

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.