How to pass environment variable in Netbeans Makefile on Ubuntu?

I am using Netbeans on Linux (Ubuntu 9.04) to create a C project.

How to pass an environment variable so that it appears in the Makefile?

If I do a regular export MYVAR="xyz" and then run make from the command line, this works fine.

But Netbeans doesn't seem to use the .bashrc environment, so if I click "build" in Netbeans, make does not work.

Interestingly, the problem does not occur on MacOSX - I added a variable to ~/.MacOSX/environment.plist , and this value is visible to Netbeans.

I found this post that suggested modifying ~/netbeans-6.8/etc/netbeans.conf . I tried this by adding -J-DMYVAR=xyz to the end of netbeans_default_options , -J-DMYVAR=xyz .:

 netbeans_default_options="-J-client -J-Xverify:none -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true -J-DMYVAR=xyz" 

But that didn't seem to work.

+4
source share
1 answer

Edit:

This answer may not be valid for the Unity-based flavors of Ubuntu.


The problem is not really related to NetBeans - it is related to Launcher Ubuntu (i.e. Gnome).

As this blog post explains, you need to add the variables to a rather obscure ~/.gnomerc (No Mercy? :) file in order to transfer them to applications running with Launcher!

So, just edit ~/.gnomerc and add the variables the same as in ~/.bashrc , for example:

 export MYVAR="xyz" 

and exit / enter.

+4
source

All Articles