How to add a user environment aware application launcher to unity panel?

Here is my problem: When I search from Unity's Dash Home for NetBeans and drag&drop it to unity launcher it, I observed that netbeans does not have access to my environment variables which were defined in my .bashrc file as follows

... 
export SCALA_HOME=/usr/local/typesafe-stack
...

When I run NetBeans from the gnome-terminal I don't observe that problem about the environment variable.

I also made a desktop file instead. Here is how I defined my netbeans.desktop file:

[Desktop Entry]
Type=Application
Name=NetBeans IDE 7.0.1
Icon=/usr/local/netbeans-7.0.1/nb/netbeans.png
Exec=netbeans
Terminal=false
Categories=Development;IDE;
StartupNotify=false

How can I modify this file so that it will be aware of the user's environment variables?

Thanks in advance,

Yours sincerely.

ciuncan


Add this:

SCALA_HOME=/usr/local/typesafe-stack

to this:

/etc/environment

Why the Unity launcher doesn't source the users environment from .bashrc, as it should IMO, is anyone's guess.


Try setting Terminal to "true":

[Desktop Entry]
Type=Application
Name=NetBeans IDE 7.0.1
Icon=/usr/local/netbeans-7.0.1/nb/netbeans.png
Exec=netbeans
Terminal=false
Categories=Development;IDE;
StartupNotify=false

I think this happens because the executable netbeans itself is not a bash script:

file `which netbeans` #shows the type of the file
head -n1 `which netbeans` #shows the first line of the file/script

(my bet is "POSIX shell script text executable", #!/bin/sh instead of #!/bin/bash)

Update: Also, try editing .profile file instead of .bashrc (and logout/login)