1

I am on a new installation of Ubuntu. I install all the updates, and then restart. I then install openjdk-7-jdk from apt, then I restart. Then I install eclipse-platform, eclipse-jdt, and eclipse-cdt. I then launch Eclipse. When I check the build path for my imported projects it decided that during the eclipse-platform installation to install openjdk-6. Okay, cool. The problem is that I can't use openjdk-7 AT ALL. There is no option to use it in the build path library manager. How can I change it so it uses openjdk-7? I tried reinstalling it already, didn't do anything. Just told me it was already installed.

EDIT: Failed at the title, fixed.

4
  • Possible duplicate? Aug 26, 2012 at 6:08
  • That one is about eclipse not accepting openjdk-6 after updating to 12.04. Mine is about eclipse not accepting openjdk-7 on a clean install. Aug 26, 2012 at 6:14
  • i downloaded eclipse JUNO from eclipse site and it has been working fine for me.
    – Ankit
    Aug 28, 2012 at 4:35
  • @Ankit It was because I installed eclipse from apt. I have an answer posted with my solution but I cannot mark it as the accepted answer because I need to wait one hour after it is posted. Aug 28, 2012 at 4:37

4 Answers 4

5

So the solution was to manually install Eclipse so that apt didn't install dependencies that were not actually dependencies.

Installing Eclipse Manually

So download Eclipse from here. I decided to use the Classic version, but if you want to use the Java EE version I'm sure that it will work.

Download it to a directory and open your terminal. Navigate to that directory by using the command

cd <insert directory path here>

Make sure that there are no files starting with eclipse in that folder. If there are then move them out of the folder temporarily. Then do this command:

tar -xzvf eclipse-*

Next,

sudo mv eclipse /opt/eclipse

Then you'll need to create a .desktop file for Eclipse in /usr/share/applications/eclipse.desktop so you have a shiny icon on your bar thingy (if anyone knows the offical name of the little bar on the side then please edit this answer so that it contains it). Do these commands

sudo touch /usr/share/applications/eclipse.desktop
sudo gedit /usr/share/applications/eclipse.desktop

Paste this in that file:

[Desktop Entry]
Version=4.2
Name=Eclipse
Comment=Integrated Development Environment
Exec=/opt/eclipse/eclipse
Type=Application
Icon=/opt/eclipse/icon.xpm
Terminal=false
NoDisplay=false
Categories=Development;IDE

Then create a symlink in /usr/local/bin so you can run it from the terminal using the command eclipse:

cd /usr/local/bin
ln -s /opt/eclipse/eclipse

That's it!

Eventually, I decided to use Sun's Java because OpenJDK was a substitute, and if I was going to do it manual, I might as well go the extra mile.

2

You will find instructions for installing different software here: https://wiki.ubuntu.com/fballem/Software%2012.04#AdditionalRepositories

I install Oracle Java 7 first.

To do that, open a terminal and enter the following two commands:

sudo add-apt-repository ppa:webupd8team/java && sudo apt-get --quiet update
sudo apt-get install oracle-java7-installer

You will also need to be able to manage users and groups:

sudo apt-get install gnome-system-tools

There is a section in the installation instructions that describes how to properly install Eclipse.

Hope this helps,

0

Have you tried going to Window->Preferences->Java->Installed JRE's and added openjdk-7? You may also get it to work installing OpenJDK 7 and removing OpenJDK 6 before installing Eclipse

2
  • I solved it by manually installing Sun Java 7 (which I wanted to use anyways, OpenJDK 7 was just a substitute) and then manually installing Eclipse. Thanks, though. I bet that if want to use OpenJDK 7 you can just install OpenJDK 7 from apt and then manually install Eclipse, I bet. Aug 28, 2012 at 3:48
  • I can't edit my old comment, so I'll add a new one. Your suggestion about installing OpenJDK 7 and removing OpenJDK 6 is what I said I did in the question -- One of the dependencies for eclipse-platform is OpenJDK 6 (even though it COULD use 7) and therefore Ubuntu installs it without me telling it to. Aug 28, 2012 at 4:45
0

I just wanted to add some info for oracle-java manual install.

1) follow this link manual java install without using ppa. It's a bit outdated but you can figure out what you should do.

2) in a terminal run: javac -version and java -version. If u don't see the proper version follow the steps described here. good luck!

You must log in to answer this question.

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