Eclipse中的环境变量 [英] Environment variables in Eclipse
问题描述
对于命令行程序,在 .bashrc
中设置了一些环境变量,并且正在读取 System.getenv()。 geto(HADOOP_MAPRED_HOME)
在hadoop程序中。但是,当我使用 System.getenv()。get(HADOOP_MAPRED_HOME)
运行一个Java程序时,从Eclipse中我将变为null。
我尝试从Eclipse中运行配置中的VM参数传递 -DHADOOP_MAPRED_HOME = test
,但在独立程序中仍然为空。如何使环境变量在Eclipse中可见?当我在Eclipse中遍历 System.getenv()
时,我看到很多变量,如 DISPLAY
, USER
, HOME
等。他们在哪里设置?我正在使用Ubuntu 11.04。
.bashrc文件用于设置交互式登录shell使用的变量。如果您希望Eclipse中提供这些环境变量,则需要将它们放在/ etc / environment中。
I am able to run a sample hadoop program from the command prompt and am trying to run the same program from Eclipse, so that I can debug it and understand it better.
For the command line program, some environment variables are set in the .bashrc
and the same are being read as System.getenv().get("HADOOP_MAPRED_HOME")
in the hadoop program. But, when I am running a java program with System.getenv().get("HADOOP_MAPRED_HOME")
, from Eclipse I am getting null.
I tried passing -DHADOOP_MAPRED_HOME=test
to VM parameters in the runtime configurations from Eclipse, but still getting null in the standalone program. How to make the environment variables visible within Eclipse? When I iterate through System.getenv()
in Eclipse, I see lot of variables like DISPLAY
, USER
, HOME
and others. Where are they set? I am using Ubuntu 11.04.
The .bashrc file is used for setting variables used by interactive login shells. If you want those environment variables available in Eclipse you need to put them in /etc/environment.
这篇关于Eclipse中的环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!