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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:24:16+00:00 2026-05-11T02:24:16+00:00

Our code uses a lot of system properties eg, ‘java.io.tmpdir’, ‘user.home’, ‘user.name’ etc. We

  • 0

Our code uses a lot of system properties eg, ‘java.io.tmpdir’, ‘user.home’, ‘user.name’ etc. We do not have any constants defined for these anywhere (and neither does java I think) or any other clever thing for dealing with them so they are in plain text littered throughout the code.

String tempFolderPath = System.getProperty('java.io.tmpdir'); 

How is everyone using system 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. 2026-05-11T02:24:17+00:00Added an answer on May 11, 2026 at 2:24 am

    I would treat this just as any other String constant you have scattered throughout your code and define a constant variable for it. Granted, in this case ‘java.io.tmpdir’ is unlikely to change, but you never know. (I don’t mean that Sun might change the meaning of ‘java.io.tmpdir’, or what system property it points to, but that you might change your mind about what system property you need to read.)

    If you’re only using a particular property within one class, then I’d define the constants right in that class.

    private final String TEMPDIR = 'java.io.tmpdir'; 

    If you’re using the same properties in different classes, you may want to define an static class of your own to hold the constants you use most often.

    public final Class Prop {     public static final String TEMPDIR = 'java.io.tmpdir';     ... } 

    Then, everywhere you need to use that constant just call it using

    System.getProperty(Prop.TEMPDIR); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 108k
  • Answers 108k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm a Project Euler administrator. Please do not post information… May 11, 2026 at 9:16 pm
  • Editorial Team
    Editorial Team added an answer You are not finding the the table names under linux… May 11, 2026 at 9:16 pm
  • Editorial Team
    Editorial Team added an answer Any system can have multiple network interfaces and internet addresses,… May 11, 2026 at 9:16 pm

Related Questions

Our code uses a lot of system properties eg, 'java.io.tmpdir', 'user.home', 'user.name' etc. We
I have built a windows C++ application that I'd like to port to linux.
A client of mine uses Oracle 9i's utl_smtp to send mails out notifications to
In a recent project I have nearly completed we used an architecture that as
I'm working on our back-end encoder service which does an awful lot of video

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.