Eclipse 4.2 in Ubuntu 12.04

Leaving in my blog for reference… And additionally, I always lose myself on “where” to put it after I download the packed archive… Here is how it worked neatly for me:
 
 
$ sudo add-apt-repository -y ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install -y oracle-jdk7-installer
$ update-alternatives --display java
 
 
# check java versions (should be 1.7.*)
$ java -version
 
 
# Get the Eclipse installer for Linux 
# (if you do not know the flavour, just choose "Classic")
# http://www.eclipse.org/downloads/
 
 
# Unpack it
$ tar -zxvf eclipse-SDK-4.2-linux-gtk.tar.gz
 
 
# if you have a previous Eclipse version installed
# just move it (in case anything goes terribly wrong, 
# you can just rollback)
$ sudo mv /usr/lib/eclipse /usr/lib/eclipse-old
 
 
# move the unpacked directory to lib
$ sudo mv eclipse /usr/lib/
 
 
# If you don't come from a previous installation, you will need 
# to create a script in /usr/bin to be the "executable" for eclipse
# something simple like /usr/bin/eclipse, 
# which only points to: /usr/lib/eclipse/eclipse
And you are done!

 

20120712_001
20120712_002

 

19 thoughts on “Eclipse 4.2 in Ubuntu 12.04

  1. Bruno Braga

    A simple: /usr/lib/eclipse/eclipse in a file called “/usr/bin/eclipse” would do. Or a symlink to the eclipse executable:

    sudo ln -s /usr/lib/eclipse/eclipse /usr/bin/eclipse

    But, for the record, that’s how it Eclipse creates the script for us upon repository installation:

    #!/bin/sh
     
    ECLIPSE=/usr/lib/eclipse/eclipse
     
    inject_update_site(){
        if [ ! -e "$1" ] ; then
        echo "W: Cannot find $1" 2>&1
        return 1
        fi
        cat - >>"$1" <<EOF
    repositories/http\:__download.eclipse.org_releases_indigo/enabled=true
    repositories/http\:__download.eclipse.org_releases_indigo/isSystem=false
    repositories/http\:__download.eclipse.org_releases_indigo/nickname=Indigo Update Site
    repositories/http\:__download.eclipse.org_releases_indigo/uri=http\://download.eclipse.org/releases/      indigo/
    EOF
     
    }
     
    if [ ! -d ~/.eclipse/ ] ; then
        $ECLIPSE -clean -initialize || exit $?
        artifact=$(find ~/.eclipse \
            -regex .*/profileRegistry/.*/org.eclipse.equinox.p2.artifact.repository.prefs)
        metadata=$(find ~/.eclipse \
            -regex .*/profileRegistry/.*/org.eclipse.equinox.p2.metadata.repository.prefs)
        if [ -z "$artifact" ] || [ -z "$metadata" ]; then
        echo "W: Cannot inject update-sites, cannot find the correct config." 2>&1
        else
        ( inject_update_site "$artifact" && \
          inject_update_site "$metadata" && \
          echo "I: Injected update sites" ) || echo "W: Could not inject update sites." 2>&1
        fi
    fi
     
    exec $ECLIPSE "$@"
    Reply
  2. sandy

    I had some problems using these instructions to install java7 jdk. Instead, I used the script at: https://github.com/flexiondotorg/oab-java6 which is currently broken, but has a fix proposed in the issue tracker: https://github.com/flexiondotorg/oab-java6/pull/56There is a howto on using the script here: http://www.gaggl.com/2012/04/installing-java6-jdk-on-ubuntu-12-04/but you need to modify the script yourself as of today.I then installed:sudo apt-get install oracle-java7-jdk oracle-java7-pluginThe update-alternatives didn’t set java7 to the default, but eclipse doesn’t seem to care.I posted this here because searching google for ubuntu 12.04 eclipse juno got me here.

    Reply
  3. Bruno Braga

    Do you have the output of the problems you said you had?It would help to understand better why you had it… I am using this here in an automated script I run on newly installed machines, and had no issues in more than 10 machines so far…

    Reply
  4. Sandy

    Okay, this is wierd. I swear when I tried it earlier it wouldn’t accept the ppa because of a key error. When I looked on the web it looked like the key was revoked by canonical because of some licensing problem…… But now it seems to work. Sorry for the false alarm.

    Reply
  5. love linux

    hi Bruno,I successed to copy Eclipse to usr/lib/eclipse and run it by ../eclipse/eclipse but when Eclipse start I didn’t find it in Dash. So what I must to do

    Reply
  6. Bruno Braga

    Is eclipse under your $PATH? As long it is executable and in there, you should be able to start from command line.

    Reply
  7. love linux

    ^^! I fix it. If you want to see it in Dash. trysudo gedit /usr/share/applications/eclipse.desktopin gedit, type[Desktop Entry]Name=Eclipse Type=ApplicationExec=/usr/lib/eclipse/eclipseTerminal=falseIcon=/usr/lib/eclipse/icon.xpmComment=Integrated Development EnvironmentNoDisplay=falseCategories=Development;IDEName[en]=eclipse.desktopit works! Immediately

    Reply
  8. Bruno Braga Post author

    Thanks or pointing that out… I recently had to migrate my site because Posterous is closing down, and did so using an automated tool, so I was expecting that some links might get wrong such as this one.

    I will see if I can fix it.

    (Update) Done! Cheers,

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>