如何在 Netbeans 8.0.2 中设置环境变量? [英] How to set environment variables in Netbeans 8.0.2?

查看:99
本文介绍了如何在 Netbeans 8.0.2 中设置环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 JRI(Java-R 接口)包附带的测试类.我正在通过 NetBeans 运行它.不幸的是,NetBeans 抱怨未设置 R_HOME.

I'm running a test class that came with my JRI (Java-R interface) package. I'm running it through NetBeans. Unfortunately, NetBeans complains about R_HOME not being set.

Creating Rengine (with arguments)
Rengine created, waiting for R
R_HOME is not set. Please set all required environment variables before running this program.
Cannot load R
Unable to start R

如何在 NetBeans 中添加 R_HOME 环境变量?

How can I add the R_HOME environment variable in NetBeans?

我尝试过的:

  1. 我在 .bash_profile 和 .bashrc 中定义了 R_HOME./Library/Frameworks/R.framework/Resources
  2. 右键单击我的项目名称 > 属性 > 运行 ... 但随后我发现无处可添加环境变量.我只看到参数"和VM 选项".

<小时>

我只是几个解决方案(在过去的半小时内).


I just a couple solutions (in the past half hour).

  1. 在 netbeans.conf 中添加行 export R_HOME=/path/to/r_home/.
  2. 从终端调用 NetBeans,其中 R_HOME 已设置.

但是,仍然对 GUI 解决方案持开放态度.

However, still open to a GUI solution.

推荐答案

在 Netbeans 12(但我认为这也适用于以前的版本)中,右键单击项目并打开 Properties 窗口.转到Actions,然后选择Run project.靠近设置属性"标签有一个Add按钮,点击它并选择选项New Environment Variable.

In Netbeans 12 (but I think this works also on previous versions), right click on project and open the Properties window. Go to Actions, then select Run project. Near the "Set Properties" label there is an Add button, click on it and select the option New Environment Variable.

这将生成一个新行,如下所示:

This will generate a new line like this:

Env.FOO=bar

重要:注意变量名为FOOEnv.前缀用于表示它是一个环境变量.如果删除前缀,该值将作为系统属性传递 (-DFOO=bar).

Important: notice that the variable is named FOO and the Env. prefix is used to indicate that it is an environment variable. If you remove the prefix the value will be passed as a system property (-DFOO=bar).

如果您需要使用调试器,请记住也在 Debug project 部分设置此项.

Remember to set this also in the Debug project section if you need to use the debugger.

这篇关于如何在 Netbeans 8.0.2 中设置环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆