Home > Java > System.getenv would not work until you restart the IDE (Netbeans)

System.getenv would not work until you restart the IDE (Netbeans)

Today i tried to get the value of a newly created environment variable, I was using Netbeans 7.1 (windows 7), it returned null, however the variable was added. I got to console and executed the program from there, it worked fine. It took me an hour to find out the problem. The problem was that while netbeans is running and you add a new Environment Variable and then try to get it by using

System.getnv() or System.getenv(String name)

it will return null until you restart your Netbeans. Probably there might be some issue that values are not updated for the Netbeans process, so you have to restart your Netbeans (i’m not sure about Eclipse and others :/). After that you’ll get the value of the newly added environment variable. A quick tip if you are facing the same, restart your netbeans..! 🙂

Advertisements
Categories: Java
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: