最近入了一台MBP,java环境搭建好后却发现如题的问题。。
System.out.println(System.getenv("NEST_HOME"));
System.out.println(System.getenv("JAVA_HOME"));
System.out.println(System.getProperty("os.name"));
eclipse内打印出来都是null,os.name可以。。,终端里echo都能打印出
导致现在maven install都是需要在终端内打mvn install,eclipse里面直接报错找不到环境变量
Mac OSX, the environment variables defined in .bashrc or .bash_profile are only exported to terminal environments.
A bundled GUI app like Eclipse does not see them,
你需要修改/etc/launchd.conf
添加一行,设置你对应的地址,然后重启机器。
setenv JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
我的博客提供了解决方法
http://blog.csdn.net/zhzdeng/article/details/64921967