Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My question is a followup for the following: How to pin Eclipse to the Unity launcher?

I created Eclipse's icon to the Unity launcher based on the selected answer at the above link. However, when I launch Eclipse via this icon, the environment variables are not properly set.

I need to call . /opt/intel/bin/compilervars.sh intel64 to use Intel compiler tools in Eclipse. However, launching via the icon can't do it. Of course, running manually Eclipse on the terminal is okay.

I tried to place . /opt/intel/bin/compilervars.sh intel64 on several places such as /etc/profile and /etc/bash.bashrc. But, still not working.

Where is the best and correct place to call such environment setup?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

My recommendation is to create a shell script that will run eclipse the same way that you want it to be launched (with presetting the environment variables, etc) and have the launcher icon call this script instead of Eclipse.

Your other option is to add the environment variables to the eclipse.ini file.

share|improve this answer
    
The shell script option is the WAY better option –  hbdgaf Mar 21 '12 at 7:56

I have eclipse in /opt

sudo mv eclipse 
cd /opt/eclipse/
sudo chown -R root:root eclipse
sudo chmod -R +r eclipse

Then I make it executable from terminal.

sudo gedit /usr/bin/eclipse

Enter the following and save, change the path if you need to.

 #!/bin/sh
 export ECLIPSE_HOME="/opt/eclipse"
 $ECLIPSE_HOME/eclipse $*

The make that executable

 sudo chmod 755 /usr/bin/eclipse

Now make sure that you can run eclipse from terminal. (move out of /opt if you are in there, maybe just go back to home "cd ~")

If thats all working and you want a unity icon.

sudo gedit /usr/share/applications/eclipse.desktop &

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
StartupNotify=true
Icon=/opt/eclipse/icon.xpm
Name=Eclipse
Comment=Eclipse IDE for Java Developers
Exec=eclipse
Categories=Development;

Now use the unity search for eclipse and run it. Right click it in the launcher, click "Keep in Launcher".

share|improve this answer

I did something similar folowing answer http://askubuntu.com/a/53061/60489 and http://askubuntu.com/a/106529/60489. The result:

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=/opt/eclipse-helios-SR2/icon.xpm
Exec=/home/user/bin/Eclipse.sh
Terminal=false
Categories=Development;IDE;Java;
StartupNotify=true
StartupWMClass=Eclipse

the StartUpWMClass made all Eclipse's windows, appear under one launcher icon.
Eclipse.sh is a shell script that makes initializations and some temp files cleanup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.