How to put executable to /usr/bin?

21,963

Just run eclipse and it will start. There is no need to run it with sudo. The update-alternatives --install made soft link needed to launch Eclipse. That's the purpose of this tool.

However, if you install Eclipse from Software Center, it may override this link, so it is better to place it in /usr/local/bin. This directory has priority when executing commands by default.

Other solution is to manually sudo ln -s /opt/eclipse/eclipse /usr/local/bin. Notice that I'm using /usr/local prefix because it's more appropriate in this case.

UPD: It seems something wrong went while you was unpacking Eclipse. The execution bit has gone. To restore it, you need to run:

sudo chmod +x /opt/eclipse/eclipse
Share:
21,963

Related videos on Youtube

Deepen
Author by

Deepen

Updated on September 18, 2022

Comments

  • Deepen
    Deepen over 1 year

    I downloaded eclipse and extracted it to /opt.

    My question is how can I make it run from terminal as like other programs like javac, java. I did with update-alternatives as follows:

    sudo update-alternatives --install "/usr/bin/eclipse" "eclipse" "/opt/eclipse/eclipse" 1 
    

    I didn't get any error. I traversed and saw /usr/bin/eclipse was there, So I did:

    sudo eclipse
    

    and I got:

    sudo: eclipse: command not found
    
    1. Is this possible to execute command eclipse and my eclipse would start?
    2. How can I make my User Program as one of the executable programs from terminal?
    3. Am I using update-alternatives for correct purpose?
    4. Any other solution?
  • Deepen
    Deepen about 10 years
    I did sudo ln -s /opt/eclipse/eclipse /usr/local/bin it was fine. Later I did sudo eclipse still same error & I know in this case it isn't neccessary to place it in /usr/bin or /usr/bin/local but wanted to learn. :)
  • terdon
    terdon about 10 years
    @DpN just don't use sudo. There is no reason for it and that is what is causing the problem.
  • Deepen
    Deepen about 10 years
    On using only eclipse command its replying this bash: /usr/local/bin/eclipse: Permission denied
  • Danatela
    Danatela about 10 years
    @DpN Use sudo chmod +x /opt/eclipse/eclipse then run eclipse.
  • Deepen
    Deepen about 10 years
    /opt/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.‌​x86_64_1.1.200.v2014‌​0116-2212/eclipse_15‌​08.so: cannot open shared object file: Permission denied
  • Deepen
    Deepen about 10 years
    Got this error after doing your last comment
  • Danatela
    Danatela about 10 years
    @DpN Can you reinstall Eclipse into /opt/eclipse? It seems you done something wrong.
  • Deepen
    Deepen about 10 years
    @Danatela SOLVED user didnt had permission. I solved it. with this...sudo chmod -R deepen:deepen /opt/eclipse then sudo chmod -R u+rw+x /opt/eclipse & it worked & also learned! :) thank you!