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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:13:03+00:00 2026-06-03T03:13:03+00:00

Is it possible to retrieve the modified value of an environment variable in a

  • 0

Is it possible to retrieve the modified value of an environment variable in a Java program?

I tried using System.getenv(). But the new value is not reflected in the program. The scenario is this:

  1. The program retrieves the value of an environment variable.

  2. The value of this variable is changed externally, while the program is still running. (It could be even manual process, like for eg, in Windows, the user changes the value from Advanced tab in My Computer->properties)

  3. The program retrieves the value of the environment variable again.

The second time the value is retrieved, it should get the modified value. I found that using System.getenv() gave me the old value only. Is there any reliable method for this? (This requirement is specific to Windows, but would love to hear general solutions too)

  • 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-03T03:13:05+00:00Added an answer on June 3, 2026 at 3:13 am

    Afaik, environment variables visible to a process are set up at process creation time.

    Subsequent modifications to the OS variables are not visible to process other than that who change them.

    However, depending on the OS, there could be some way to retrieve them. E.g. on Windows Os, they are kept in the registry, so you can read from them.

    Try reading the key at HKCU\Environment for current user variables, and the key

    HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment for system variables.
    

    See this question about Windows registry for a useful class to read the registry.

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

Sidebar

Related Questions

Is it possible to retrieve variable set in onreadystatechange function from outside the function?
Is it possible to retrieve the underlying hostname/port from a new TcpClient? TcpListener listener
is it possible to retrieve statistics about the minimal or maximal value of a
is it possible to retrieve by using connection.getschema() the description item from a sql
Is it possible to retrieve the information from a sent Push Notification using the
Is it possible to retrieve an array of request parameters with same key using
Possible Duplicate: Retrieve Windows Experience Rating Using .NET, is there a way to programmatically
It's possible to retrieve all permissions of a file in NTFS FileSystem with Java
Is it possible to retrieve a stored procedure using c#? What i need to
Is it possible to retrieve the contacts without using Activity class? I'm using LWUIT

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.