249

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)

4
  • 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, 2012 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, 2012 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, 2012 at 12:38
  • I had the same problem with Eclipse 4.5.2 and Ubuntu 14.04 - accepted answer worked.
    – Gustave
    May 11, 2016 at 5:31

16 Answers 16

354

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.

24
  • 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, 2011 at 23:50
  • 19
    ~/.local/share/applications is probably where you want to put it. Nov 17, 2011 at 4:15
  • 8
    Do we seriously need to edit a 10-line file and run some file permissions command to create an app shortcut in 2014? Nov 7, 2014 at 20:44
  • 2
    @Tim: what does the lack of simple UX for creating a shortcut have to do with security? Both Mac OS and Windows do a great job of making it easy to create shortcuts. Ubuntu does not. Nov 3, 2015 at 4:20
  • 3
    This answer 5 years old, and the only one that still works in 2016. Of course, Ubuntu could just upgrade the version of Eclipse on the software center so people would not have to do manual installs that break the shortcut generation process. May 16, 2016 at 20:31
90

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

5
  • 26
    +1 ... if only for using an animated GIF in your answer!
    – fossfreedom
    Nov 17, 2011 at 13:21
  • gotta love this answer Jul 29, 2012 at 23:15
  • Absolutely amazing :-). Good job! Apr 20, 2013 at 8:53
  • .. good bos.. ^^ Jun 12, 2013 at 7:11
  • Really helpful, many thanks.. But when I click on the launcher, although it starts the program, it shows another icon on the launcher.
    – Maroun
    Jan 6, 2015 at 9:02
18

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:

1
  • 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? Feb 19, 2012 at 23:11
12

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!

6
  • 1
    I think `gnome-desktop-item-edit' needs a certain package?
    – gontadu
    Apr 7, 2012 at 10:49
  • @Eshwar 'sudo apt-get install --no-install-recommends gnome-panel'
    – user92200
    Nov 11, 2012 at 21:50
  • 1
    This doesn't pick up the icon of the app, and when dragged into the Unity task bar, it spawns yet another icon for the app. Don't mean to troll, but the experience of creating a shortcut in OS X or Windows is way, way better. Nov 7, 2014 at 20:48
  • Click the spring icon in the window to change it to what you want.
    – user72056
    Apr 29, 2016 at 12:00
  • 1
    Doesn't work for me in Ubuntu Desktop 16.04 LTS for Eclipse MARs...getting error at the time of launch...
    – Ashu
    May 21, 2016 at 17:40
4

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.

1
  • drag and drop eclipse.desktop on to the launcher is the simple last step is required
    – Raaghu
    Jul 19, 2017 at 12:23
2

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.

2

18.04

Click Show Applications, find Eclipse in the list, right click & Add to Favourites.

2
  • 2
    Technically speaking, there is no Unity in 18.04. However, the instruction for the new default desktop (GNOME) is probably OK to be posted here.
    – Melebius
    May 3, 2018 at 7:30
  • Whatever the launcher is in 18.04, it looks the same as what was in 16.04 and 14.04. I don't overly care what it is called.
    – Phil
    May 7, 2018 at 0:17
1

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.

1

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
1
  • It's already executable and your other suggestion of changing sh to bash made no difference.
    – csilk
    May 3, 2012 at 21:33
1

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.

1

I have tested it for Eclipse MARs(not the installation one)-but the one which is tar.gz package on Ubuntu Desktop 14.0.4

gedit /usr/share/applications/eclipse.desktop

contents for this:

[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

Then in the finder search for Eclipse when the menu comes up - just drag it to the launcher and then it will start working. Very simple steps and nothing complicated to get it up and running.

0

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".

1
  • This works, but I don't get an icon.
    – schmmd
    Jul 21, 2011 at 17:41
0

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!

0

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
1
  • If you look at my config you can see that I am not doing anything with special characters or spaces.
    – csilk
    Jun 22, 2012 at 14:07
0

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.

0

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 ~/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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .