Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set environment variables in Netbeans 8.0.2?

Tags:

java

r

netbeans

jri

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

How can I add the R_HOME environment variable in NetBeans?


What I have tried:

  1. I defined R_HOME in .bash_profile and .bashrc. /Library/Frameworks/R.framework/Resources
  2. Right-clicking my project name > Properties > Run ... but then I see nowhere to add environment variables. I only see "Arguments" and "VM Options".

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

  1. Add the line export R_HOME=/path/to/r_home/ in netbeans.conf.
  2. Invoke NetBeans from the terminal, where R_HOME is already set.

However, still open to a GUI solution.

like image 425
ktm5124 Avatar asked Nov 02 '15 18:11

ktm5124


People also ask

How do I change environment variables?

On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Click New to create a new environment variable.

What environment variables should be set for java path?

For Java applications, PATH must include the following directories: JDK's " bin " (binary) directory (e.g., " c:\Program Files\java\jdk1. x.x\bin "), which contains JDK programs such as Java Compiler " javac.exe " and Java Runtime " java.exe ".


1 Answers

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

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).

Screenshot of Netbeans 12 actions needed for adding an environment variable

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

like image 60
xonya Avatar answered Sep 20 '22 12:09

xonya