1

Unity Search Results for eclipse

I've seen a few questions similar to this, however, I'm hesitant to follow them as I've already broken Ubuntu once and had to reinstall while trying to get custom themes to work on my machine.

Basically, I have a copy of Eclipse installed and it runs properly but I have to navigate to the installation folder rather than search for it in Unity or lock it to the launcher. I've gathered that I need to move the installation folder to the 'opt' directory and create a desktop file of some kind with the information for the application. I have absolutely no idea how to move files with Terminal and I cannot place the files in the directory through the native file manager.

Could someone please walk me through this step by painstaking step? Please do not assume I know anything specific too Ubuntu or Linux. I also have little experience with Windows command line.

At present the eclipse launcher is here: /home/USERNAME_HIDDEN/eclipse/java-neon/eclipse

Thanks in advance to anyone who would be willing to help me.

1

Place the installation to a common area (/opt).

$ sudo mkdir /opt/eclipse
$ sudo mv  /home/USERNAME_HIDDEN/eclipse/java-neon/ /opt/eclipse/

make a common link to the eclipse program to /usr/local/bin/eclipse.

$ sudo ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse

Test running eclipse from the commandline.. Type this without a path:

$ eclipse

If it doesn't work the exec program might be at:

/opt/eclipse/eclipse/eclipse

Fix this by removing the previous link and linking the exec with:

$ sudo rm /usr/local/bin/eclipse
$ sudo ln -s /opt/eclipse/eclipse/eclipse /usr/local/bin/eclipse

When you can bring up Eclipse from the commandline, you can make a desktop entry by creating a desktop program with.

Create the GUI Launcher

$ gedit  /home/USERNAME_HIDDEN/.local/share/applications/eclipse.desktop

copy and paste this into the editor then save it:

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Eclipse
Exec=/usr/local/bin/eclipse
Comment=Eclipse Integrated Development Environment
Icon=/opt/eclipse/eclipse/icon.xpm
Categories=programing;IDE;utility

Now eclipse should appear in your Ubuntu Launcher search button.

5
  • If I'm reading this correctly... you mv some/all of the eclipse folder to /opt, but then your ln commands point back to the user's /home? – heynnema Dec 6 '16 at 18:17
  • @heynnema What a typo... I'll fix it ASAP. Thanks! – L. D. James Dec 6 '16 at 18:34
  • Right now I'm fixing it by actually renaming my /opt/ install and actually extracting a fresh tar file to my home directory and will post the tested working steps. – L. D. James Dec 6 '16 at 18:39
  • No, several searches on the topic have recommended moving the program to the /opt/ folder for some reason. The installation is located in the default for the eclipse java-neon installer. /home/shockemc/eclipse/java-neon/eclipse Basically both answers are correct I just needed to create a GUI launcher but I put in the wrong file path. Thanks you all for the help. – shockemc Dec 6 '16 at 18:54
  • I agree with the searches. That is why I provided steps for moving the installation to /opt/eclipse. Once moved, then linked to /usr/local/bin you'll have eclipse located in the common /opt folder and easily called from the default /usr/local/bin which is already in your path. – L. D. James Dec 6 '16 at 18:58
0

You cannot simply move a program around and expect it to work. And you don't have to. Follow these steps:

  1. Open a Terminal.
  2. Copy the following code (select it and press Ctrl-C) and paste it in the terminal (Shift-Insert):

    cd ~/.local/share/applications
    cat >Eclipse.desktop <<EOF
    [Desktop Entry]
    Version=1.0
    Name=Eclipse
    GenericName=Integrated Development Environment
    Comment=Develop software in a variety of programming languages
    Exec=/full/path/to/eclipse
    Icon=/usr/share/app-install/icons/eclipse.png
    Terminal=false
    Type=Application
    Categories=Development
    EOF
    chmod 755 Eclipse.desktop
    gedit </dev/null &>/dev/null Eclipse.desktop
    

    You may have to press Enter if the cursor remains at the end of the last pasted line.

  3. A Gedit window will open allowing you to edit the desktop file; replace /full/path/to/eclipse with the actual full path to the Eclipse executable, and, if needed, /usr/share/app-install/icons/eclipse.png with the full path to a suitable icon. (An icon is a small picture in PNG or SVG format.)

  4. Save the file and close the editor, then logout and login again. You should now have an icon for Eclipse in the Applications lens, and you should be able to search for Eclipse in the Dash.

Please report back with the results.

5
  • Thank you for the quick response, I tried your suggest once and I thought it worked. The g-edit window showed up and I replaced the path with the one displayed in the properties window for eclipse and the icon provided. However after a restart, my search for "eclipse" did not bring up anything new and so I decided to try it again.. apparently this was a mistake. The video is still uploading from my phone but Ubuntu crashes on start and goes to a blue screen. I think I will just deal with it. Thank you again for trying, I probably messed it up myself. – shockemc Dec 6 '16 at 17:08
  • Ubuntu goes to a blue screen? – AlexP Dec 6 '16 at 17:11
  • Ya I'm reinstalling it now.. I don't know what happened. Using my windows desktop to post this. – shockemc Dec 6 '16 at 17:58
  • @AlexP answer was correct, and shouldn't have caused what you describe. And reinstalling Ubuntu so quickly was not the best first choice to solve the problem. – heynnema Dec 6 '16 at 18:09
  • His answer was indeed correct and I tried to upvote it but sadly I do not have enough rep to do so. I found my error after re-installing ubuntu. If you right click a file and select properties the path they give isn't to the file itself as is the case with Windows but rather the directory in which it is located. So I pasted /home/shockemc/eclipse/java-neon/eclipse for the executable file and the icon. I don't know why that caused Ubuntu to crash on startup but all is well and the problem is solved. Thanks again. – shockemc Dec 6 '16 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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