Eclipse does not recognize environment variables Eclipse does not recognize environment variables shell shell

Eclipse does not recognize environment variables


To make environment variable visible in GUI app you need to put it into /etc/launchd.conf. Type in terminal:

sudo nano /etc/launchd.conf

Then add variables to launchd.conf:

setenv VARIABLE_NAME variable_value

Press Ctrl+O, Enter, Ctrl+X, then reboot.


NOTE: I just found out that Project Properties panes don't load correctly this way. More to research on how to launch...

This might be a bug in Juno (4.2) version of Eclipse (as well as the 3.x predecessor)...This stackoverflow article implies 2 things

  1. one way to get Eclipse to be aware of your shell environment variables is to start Eclipse from the bash shell / command line (it will thereby inherit the environment from the shell.

  2. The other way seems to imply a bug in Eclipse prior to Kepler (4.3): if you upgrade to to Kepler (4.3), the problem went away for the OP.

Also useful for getting this to work on OS X, were this article, and finally, how to launch an app from command line

Here's a step-by-step for OS X using QuickSilver as the launcher. I created a .sh file in my ~/Applications/ folder, and now I run that from QuickSilver (I think the same basic process is possible with Spotlight also).

  1. I created eclipse.sh with this line to call the .app "file". For me, this is part of the ADT Bundle, but just replace the path below with the path to the .app file (which is the icon you run from your Applications folder, or wherever your Eclipse install is located)

BEGIN EDIT

My originally-posted line/Users/mike/DevInstalls/adt-bundle-mac-x86_64-20140702/eclipse/Eclipse.app/Contents/MacOS/eclipseworks until I try to open the properties panels in Project Properties.  The panels won't open, so I tried the following change to fix it/Users/mike/DevInstalls/adt-bundle-mac-x86_64-20140702/eclipse/Eclipse.app/Contents/MacOS/eclipse &but this won't work when launched from Quicksilver.Either way, launching gracefully via QuickSilver has nothing to do with the OP, so I'm going to stop pulling my hair out over it. :-/

END EDIT

Then, back at the command line run "sudo chmod 755 ./eclipse.sh" to set the permission properly so it can be executed.

2.a. Next, I had to configure QuickSilver to find this shell command. For that, I hit the QuickSilver key stroke, and clicked the top-right triangle to open its preferences, and selected Catalog..., then clicked Custom on the left, the plus symbol to add an entry on the right, then selected File & Folder Scanner, then selected the folder the shell script was in, then clicked the tiny bottom-right "i" button, the in the window the expands to the right, under "Include Contents" I clicked "Folder Contents".

2.b. Alternatively, in the Quicksilver preferences, you can enable under "Catalog", the "Bash Command History". I opted to not use this approach so my QuickSilver history wouldn't get flood with command history noise.