How to Install and setup Eclipse with Sun’s Java

Sponsored Link
Eclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle. A large and vibrant ecosystem of major technology vendors, innovative start-ups, universities, research institutions and individuals extend, complement and support the Eclipse platform.

Installing Eclipse,Sun Java in Ubuntu

sudo apt-get install eclipse sun-java6-jdk

This will install the required packages, however, Eclipse will run very slowly since it will be using GNU's java, not Sun's. We now need to make Sun's java the default.

sudo update-java-alternatives -s java-6-sun

Next, edit the JVM configuration file

sudo -b gedit /etc/jvm

and add the following to the top of the file

/usr/lib/jvm/java-6-sun

There is a bug right now were Eclipse ignores Ubuntu's java-common settings and uses its own (bug 45347). To work around the bug, you need to edit Eclipse's java_home file

sudo -b gedit /etc/eclipse/java_home

and add

/usr/lib/jvm/java-6-sun

to the top of the file.

Lastly, if you have lots of memory you may want to increase the heap size (warning: If you make the heap size too large then parts of eclipse will continuously swap in and out.).The settings can be altered by editing the eclipse.ini file.

For feisty users:

sudo -b gedit /usr/lib/eclipse/eclipse.ini

The argument Xms refers to the minimum heap size and Xmx refers to the maximum heap size.

Sponsored Link

Incoming search terms:

Related posts

23 thoughts on “How to Install and setup Eclipse with Sun’s Java

  1. Hi,

    Am a newby to this .. struggling with <>

    It goes through the whole effort and then pops up a window (in terminal that looks like the old DOS editors (blur backround – no options) and when I close it all, the terminal window is closed and the app is not installed .. also cannot execute anything else..

    I only have /etc/jvm.d not the /usr/lib/eclipse/ ???

    Help would be appreciated..

    Furthermore I think your assistance is great., Have used it for other things..

    [Reply]

  2. I am a newbie myself. I am not sure if I am getting your question right but I hope this helps. Press tab and the ‘OK’ on the DOS like screen will be highlighted. Now press enter.

    [Reply]

  3. dear mr. geek,

    thanks for your article. i linked to it when blogging about using Subclipse together with Eclipse Ganymede.

    best regards
    Stotti

    [Reply]

  4. Thanks worked great, also with 9.04
    In my case I needed sun sdk 1.5 (I need that for a course I’am following) changes I had to make :
    sudo update-java-alternatives -s java-1.5.0-sun
    and ofcourse the directory is in that case :
    /usr/lib/jvm/java-1.5.0-sun

    kind regards,
    Jeroen

    [Reply]

  5. Nice tutorial but that installs eclipse 3.2 which is almost 3 years old. This June eclipse 3.5 will be out. With eclipse your best bet is to just download and install from the elipse.org site.

    Erik

    [Reply]

  6. Post is still helping even today! Finally got around to figuring it out this helped a lot. Now to get 3.5 running :)

    [Reply]

  7. This might help others.

    After installing, I had to change the System->Preferences->Main Menu->Programming->Eclipse (rightclick)properties to point to /usr/lib/eclipse/eclipse

    The installation seems to be done as root which causes several problems:
    1. The workspace points to root/workspace3.2 and isnot accepted. Thinks that is is use. I had to remove all folders for $workspace.
    2. The workspace dialog insists on /root/Workspace3.2 event when I change it to /home/intrader/workspace and check the checkbox
    3. The IDE does not have a splash, or java perspective. I attempt a ‘Software Update’ and that fixes some things – now I have a java perspective.
    3. The Java ‘new Project’ does nothing; when I have the cheat sheet perform the step it tells me “the command dis not complete successfully”

    The version is old – how do I get rid of this ans isntall the newest?

    Thanks

    [Reply]

  8. Hi,
    All the instructions work great! However, I
    can’t see the documentation for the standard system libraries. I have downloaded the docs for java-6-sun.

    Please help!
    Ambarish

    [Reply]

  9. For Ubuntu 9.10, and Eclipse Galileo downloaded separately from site using the Sun JDK, to fix the non-responding buttons (you will recognise them…) use “export GDK_NATIVE_WINDOWS=1″ before running or in a script. To fix extremely slow rendering, use “-Dsun.java2d.opengl=true” in the run configuration option for the JVM. This also speeds up any separate slow Java apps ‘cos opengl pipeline not enabled by default, fallback is software rendering.

    [Reply]

  10. Thanks, I know this is an old post, but it just fixed a problem I was having in Eclipse. I wasn’t able to submit files larger than 30kb to my SVN repository. Eclipse would fail on commit with the error “An internal error has occurred during “SVN Commit”.” Following the commands you listed fixed the problem.

    Thanks again!

    [Reply]

  11. Hey

    I followed te steps exactly and I still get
    The custom VM you have chosen is not a valid executable.

    Now, in the folder /usr/lib/jvm/ I have: java,
    java-6-sun, java-6-sun-1.6.0.1.6 and java-gcj.

    In the folder /etc/java-6-sun/jvm.cfg I have put /usr/lib/jvm/java-6-sun
    In the folder /etc/eclipse/java_home I have also:
    /usr/lib/jvm/java-6-sun
    In /etc/profile I put :
    export JAVA_HOME=”/usr/lib/jvm/java-6-sun”

    Can anyone tell me the problem? I have posted this on several forums and no answer. Maybe I can get help from you…

    Thanks a lot

    [Reply]

  12. Great thanks for the “GDK_NATIVE_WINDOWS=1″ advice.

    But I’m working on a Plug-In and need to run an Eclipse instance from Eclipse itself (Run As => Eclipse Application) from time to time.
    When I do this, the new Eclipse instance comes with the button errors.
    How do I get the “GDK_NATIVE_WINDOWS=1″ into the Run Configuration?

    [Reply]

  13. not so easy…. after adding /usr/lib/jvm/java-6-sun and saving the file an error message occured: Could not find the file /etc/eclipse/java_home.

    ?? an help appreciated

    [Reply]

  14. I asked:
    > How do I get the “GDK_NATIVE_WINDOWS=1? into the Run Configuration?

    Found out myself: There is a tab called “Environment” in the Run Configuration. Just add the variable there.

    [Reply]

  15. I followed all of the steps, but there’s no “eclipse” folder in the “etc” folder to go into to edit the file to fix the bug.

    [Reply]

  16. I forgot to mention this in my last comment, but it also wouldn’t compile things. All I was trying to do was do a test run by compiling and running the hello world program, and it gave me an error message for the ” public static void main( String[] args)” line. All it had highlighted was the word “main.”

    [Reply]

  17. sir , this is somu when i installed eclipse i got this bug “jvm wa not found after searching the path c:\programfiles\eclipse\jre\bin\javaw.exe “. tell me some instruction to solve this problem … plz help me as soon as posible sir…

    [Reply]

  18. I have the same problem of not having an eclipse folder in the etc directory. So is this a problem?? and if so how do I fix this?

    [Reply]

Leave a comment

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