0

I am using Ubuntu 12.04. In my user home, I added one environmental variable to .bashrc file.

export MYCONFIG_HOME=/home/myuser/config-1.0

And I run the .bashrc file

source ~/.bashrc

I open my STS, added the following code

public static void main(String[] args) {
        String myHomeVar = System.getenv("MYCONFIG_HOME");
        System.out.println(System.getProperty("user.name"));
        System.out.println(myHomeVar);
    }

It gives me following output

myuser
null

When I do echo $MYCONFIG_HOME, it is giving the value. Why is it not getting in the Java program?

Do I need to restart the system? If I have to restart, is there anyway to get the value without restarting the system?

NOTE: It got worked when I restarted the system.

Cœur
  • 37,241
  • 25
  • 195
  • 267
iCode
  • 8,892
  • 21
  • 57
  • 91

0 Answers0