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.

How can I pin eclipse indigo 3.7 I have 'installed' at /opt/ to the taskbar?

I have tried launching eclipse and right-clicking to choose the 'keep in launcher' option. But when I click that icon, after closing eclipse, it doesn't start eclipse.

I have already looked at How do I add Eclipse Indigo to the launcher? but no answer worked for me. (Mod note: The answers from this thread are now merged into this one)

share|improve this question
    
I can start Eclipse directly from the executable in /home/USERNAME/eclipse. When I do this, the Eclipse icon on the dock has a little arrow next to it, so it is aware of Eclipse running. How strange. –  csilk May 3 '12 at 20:17
1  
I've had the same error, I was trying to execute eclipse_64bit on ubuntu_32bit. Have you downloaded 64bit version of Eclipse? Have you checked your ubuntu installation? –  user61448 May 7 '12 at 20:54
    
i think you dont need the /bin/sh part in the Exec section. Remove it and it should work. By the way, what is your username? –  Salem Aug 7 '12 at 12:38

14 Answers 14

up vote 197 down vote accepted

For 11.10 and newer

First, create a .desktop file to eclipse:

gedit ~/.local/share/applications/opt_eclipse.desktop

Then, paste this inside (dont forget to edit Exec and Icon values):

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=** something like /opt/eclipse/icon.xpm **
Exec= ** something like /opt/eclipse/eclipse **
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=Eclipse

After that, open that folder with nautilus:

nautilus ~/.local/share/applications

If you want to use this launcher outside dash/launcher (ex: as a desktop launcher) you need to add execution permission by right clicking the file and choosing Properties -> Permissions -> Allow execution, or, via the command-line:

chmod +x ~/.local/share/applications/opt_eclipse.desktop

Finally drop opt_eclipse.desktop to launcher.

share|improve this answer
1  
Is it really necessary to create the .desktop file outside user's home folder? As you can see, this requires sudo, which is potentially unsafe; also, the file may be removed by a system upgrade or reinstall. What are the benefits? –  Sergey Nov 16 '11 at 23:50
    
No, you can create the file where you want. I suggested this location because it's the folder where usually .desktop files are stored (so it is "found" by applications like unity, gnome do, etc). The name is unfortunate, because it's the same of the .desktop file created by eclipse package, when installed by Software Manager. I'll change it. –  Salem Nov 17 '11 at 0:09
15  
~/.local/share/applications is probably where you want to put it. –  Jorge Castro Nov 17 '11 at 4:15
1  
@Catskul i meant the launcher. –  Salem Jan 2 '12 at 15:09
1  
I also had to append StartupWMClass=eclipse at the end of the .desktop file, or else Unity was unable to detect if an instance was already running or not (thus trying to re-launch eclipse each time, and failing due to locks on the workspace) –  alci Mar 8 '12 at 9:29

If not using a *.deb file, your software is not included in menus or the launcher. The easy way: Just start Eclipse from /opt and look for an icon appear in Unity launcher (the sidebar). Right click and check "Keep in launcher".

share|improve this answer
    
This works, but I don't get an icon. –  schmmd Jul 21 '11 at 17:41

11.04

If user21580's answer doesn't work (great suggestion, but I think it didn't work for me when I installed Indigo), you can try adding an eclipse.desktop file to ~/.local/share/applications/, with these contents:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
StartupNotify=true
Icon=<path-to-eclipse-install>/icon.xpm
Name=Eclipse Indigo 3.7
#Exec=env UBUNTU_MENUPROXY=0 <path-to-eclipse-install>/eclipse
Exec=env <path-to-eclipse-install>/eclipse

If you experience bugs, you can try the Exec line which is commented out instead of the current one.

References:

share|improve this answer
    
Thanks! This one worked for me. Too bad Ubuntu has to make it so difficult. Why not just right click on the launcher for this kind of option? –  Twisted Pear Feb 19 '12 at 23:11

I think this is a cleaner version:

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=eclipse
Exec=eclipse
Terminal=false
Categories=Development;IDE;Java;

You should add this to /usr/local/share/applications/eclipse.desktop and symlink eclipse on /usr/bin. You might want to change the icon path if your theme doesn't have a eclipse button (ex. ambiance/radiance).

If I'm not mistaken this is the file that comes with galileo from the repos (wich I removed), and I've been using it with Helios and now Indigo.

share|improve this answer

Let me show you how to create a custom launcher and pin it to the Launcher.

1) First, install gnome-panel:

sudo apt-get install --no-install-recommends gnome-panel

2) To create a new desktop shortcut run the following command either in the terminal or using Alt-F2:

gnome-desktop-item-edit --create-new ~/Desktop

A window will pop up, submit your shortcut details and click OK:

enter image description here

Your shortcut will now appear on your desktop.

Then drag your new shortcut from Desktop to your Launcher.

That's it!

share|improve this answer
1  
I think `gnome-desktop-item-edit' needs a certain package? –  Eshwar Apr 7 '12 at 10:49
    
@Eshwar 'sudo apt-get install --no-install-recommends gnome-panel' –  saleemrashid1 Nov 11 '12 at 21:50

For Ubuntu 11.10, 12.04, 12.10

If the applications folder does not exist inside ~/.local/share/ create it

mkdir ~/.local/share/applications

Check if your installation left you with a workable .desktop file for Eclipse and copy it if exists

cp /usr/share/applications/eclipse.desktop ~/.local/share/applications/

If the file does not exist create a .desktop file for Eclipse in your ~/.local/share/applications/ folder using gnome-desktop-item-edit, ie:

gnome-desktop-item-edit --create-new ~/.local/share/applications/

On the name set it to Eclipse, on the command enter the path to the binary file of Eclipse, insert a comment if you want and click the icon to select the icon that you desire for Eclipse.

Press ok when you are finished.


After copying the file or creating your own open that folder location

nautilus ~/.local/share/applications/

Locate the file you just created and drag it to the launcher

enter image description here

share|improve this answer
22  
+1 ... if only for using an animated GIF in your answer! –  fossfreedom Nov 17 '11 at 13:21
    
gotta love this answer –  Some Noob Student Jul 29 '12 at 23:15
    
Absolutely amazing :-). Good job! –  Rostislav Stribrny Apr 20 '13 at 8:53
    
.. good bos.. ^^ –  Ahmad Azwar Anas Jun 12 '13 at 7:11

Atem18 is correct. Do this if you want your launchers to be available system wide. This is how I automated creating launchers. This assumes you have already installed gnome-panel.

1- open terminal

2- mkdir /home/"your-user-name"/bin or right click on your home file browser and make folder bin.

3- $ source .profile or logout and login

4- gedit in terminal or from dash

  • #!/bin/sh
  • sudo gnome-desktop-item-edit /usr/share/applications/ --create-new)

Don't use the hyphens/bullets and no need to indent.

5- Give it a name with no spaces save to your new bin directory and then make executable(chmod a+x launcher-script) or right click goto properties> Permissions and click the execute box.

6- now in terminal: $ sudo gnome-desktop-item-edit /usr/share/applications/ --create-new

7- You should have the Create Launcher gui open.

Type = Application in Terminal THIS ONLY APPLIES THIS TIME. Most of the time it will be Application after this.

8- You can name what you wish. NO-SPACES-ALLOWED I called mine Create-Launcher

9- In the command field put the path to the script from step 3

/home/mike/bin/launcher-script Use your user name and the actual file name you created.

10- Click the spring to add an icon. I made on on the Gimp but there are lots of icons you could use that are very generic and already installed. Click the spring and it will take you to some.

11- Once you're finished click ok. Now you can navigate your file browser down to /usr/share/applications and you will find your new launcher. Simply drag it to your launcher bar and you are ready to go. This process puts your launchers in a place where all users can access them. Most of what I have found puts thing on the desktop which might be fine for some but not for me. I hope you find this helpful.

Now you can easily create your eclipse launcher and any others too.

After thought, every time you create a new launcher you will have to enter your password. This is necessary to make the new launcher accessible to all users. It will belong to root and the group will be root this way. That is the way the rest of the system comes configured. If you cd to /usr/share/applications, type ls -l and, verify for yourself. Ubuntu should have supplied their os with an application already installed for creating launchers. There are other things I disagree with like the screensaver and no short cut to the desktop. I have only been on 11.10 for a couple days. I am going to give it the college try. If I still don't like it in a month I will fix it then.

share|improve this answer

For Ubuntu 11.10

Download gnome-panel from the Ubuntu Software Center if not already installed.

Run the Gnome "Create Launcher" from the terminal like so:

gnome-desktop-item-edit --create-new ~/.local/share/applications/

A dialog box will appear.

  • For Name: you'll probably want to name it "Eclipse".
  • For Command: browse to where the Eclipse executable is located.
  • For Comment: something like "Eclipse IDE" should do.
  • For the icon, click the springboard icon, then navigate to the folder where the executable is located and select icon.xpm.
  • Click Okay. You've now made the launcher icon. All that's left is to put it in the launcher bar.
  • Open the folder ~/.local/share/applications/ . You may need to hit ctrl-h to show the hidden .local folder.
  • Drag the Eclipse launcher icon you just made onto the launcher.

Done!

share|improve this answer

For 12.04
I prefer to install from repository. This just works for me and I document the Graphical way to do it here.

If you must install the portable version(getting the tar.gz from the eclipse website) here's the best way I've found to get portable working and locked to the Launcher.

Download the eclipse portable and extract to your Desktop. In a terminal:

sudo apt-get install eclipse-platform
sudo mv Desktop/eclipse /opt/eclipse
/opt/eclipse/eclipse

Right click the icon in the launcher bar and pin to bar. I can verify that it's portable and not the platform because I have LOADS of plug-ins installed which don't appear when launched this way.

You may find that creating a .desktop file works, but that you run into mysterious behaviour if you have more than one portable instance installed.

share|improve this answer

Try

Exec=/bin/bash /home/USERNAME/eclipse/eclipse

or make /home/USERNAME/eclipse/eclipse executable

sudo chmod u+x /home/USERNAME/eclipse/eclipse

and use:

Exec=/home/USERNAME/eclipse/eclipse
share|improve this answer
    
It's already executable and your other suggestion of changing sh to bash made no difference. –  csilk May 3 '12 at 21:33

Make sure if you're using the 32bit version on a 64bit machine, you install the 32bit libraries (ia32libs-multiarch i think is the package in Precise).

Alternatively, if you're trying to run 64bit Eclipse on a 32bit machine, you need to download the 32bit version instead.

share|improve this answer

In the exec line put the executable (eclipse) directly. Don't try to add special characters to space, i.e., if your eclipse is in the /home/username/My Dev Programs/Eclipse/eclipse put the entire line with the spaces on the exec line. Here is a my eclipse.desktop file:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=/home/marcos/Imagens/Icons/Eclipse Icon 128.png
Name=Eclipse
Exec=/home/marcos/Dev Software/eclipse/eclipse
Comment=Eclipse IDE
Name=Eclipse
Comment=Eclipse IDE
share|improve this answer
    
If you look at my config you can see that I am not doing anything with special characters or spaces. –  csilk Jun 22 '12 at 14:07

Use this:

[Desktop Entry]
Version=4.2
Name=Eclipse
Comment=Java IDE
Exec=/home/USERNAME/eclipse/eclipse
Type=Application
Icon=/home/USERNAME/eclipse/icon.png
Terminal=false
NoDisplay=false
Categories=Development;IDE

It works for me.

share|improve this answer

If you have donwloaded Eclipse from the website instead of install it from repositories you can lock the launcher doesn't work. You can solve this by writting the file with extension .desktop, in our case eclipse.desktop.

 [Desktop Entry]
 Name=Eclipse
 Comment=Eclipse
 Exec=/path/eclipse
 Icon=/path/icon.xpm
 Terminal=false
 Type=Application

Where /path is where you've installed eclipse. After you have saved it, you have to give execution permission:

$ chmod +x eclipse.desktop

Then you execute it with Nautilus and by clicking (right click) over the laucher you can lock to the launcher. And you can launch the app correctly.

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.