如何在Ubuntu上将环境变量传递给Netbeans Makefile? [英] How do I pass an environment variable to a Netbeans Makefile on Ubuntu?
问题描述
如何传递一个环境变量,这对Makefile是可见的?
如果我正常执行导出MYVAR =xyz
,然后运行 make
但Netbeans似乎没有使用 .bashrc
环境,所以如果我在Netbeans中单击build,make将失败。
有趣的是,MacOSX上似乎并不会出现此问题 - 我将变量添加到〜/ .MacOSX / environment.plist
,Netbeans可以看到该值 。
我发现这篇文章,建议修改〜/ netbeans的-6.8的/ etc /的netbeans.conf
。我已经尝试过,将 -J-DMYVAR = xyz
添加到 netbeans_default_options
的末尾,即: p>
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
但这似乎没有起作用。
strong>编辑
这个答案可能对基于Unity的Ubuntu版本无效。
< hr>
该问题实际上与NetBeans无关 - 它与Ubuntu(即Gnome)Launcher相关。
As 这篇博文解释说,你需要添加变量到相当模糊的〜/ .gnomerc
(No Mercy?:)文件,以便将它们传递给应用程序star ted with Launcher!
所以只需编辑〜/ .gnomerc
并添加变量,就像〜/ .bashrc
,例如:
export MYVAR =xyz
和注销/登录。
I'm using Netbeans on Linux (Ubuntu 9.04) to build a C project.
How do I pass in an environment variable so that's it's visible to the Makefile?
If I do a normal export MYVAR="xyz"
and then run make
from the command line this works fine of course.
But Netbeans doesn't seems to use the .bashrc
environment, so if I click "build" in Netbeans, the make fails.
Interestingly, the problem doesn't seem to occur on MacOSX - I've added the variable to ~/.MacOSX/environment.plist
, and that value is visible to Netbeans.
I found this post which suggested modifying ~/netbeans-6.8/etc/netbeans.conf
. I've tried this, by adding -J-DMYVAR=xyz
to the end of netbeans_default_options
, ie:
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 this didn't seem to work.
Edit:
This answer is possibly not valid for Unity-based flavours of Ubuntu.
The issue is actually nothing to do with NetBeans - it's related to the Ubuntu (ie Gnome) Launcher.
As this blog post explains, you need to add variables to the rather obscure ~/.gnomerc
(No Mercy? :) file in order for them to be passed to applications started with Launcher!
So just edit ~/.gnomerc
and add the variables as you would to ~/.bashrc
, eg:
export MYVAR="xyz"
and logout/login.
这篇关于如何在Ubuntu上将环境变量传递给Netbeans Makefile?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!