0

I recently messed up badly in eclipse, so was doing some digging to update/fix jdk.

While executing java -version to find Java version on my Ubuntu 12.04, i get the below error and even on following sudo apt-get install <selected package> for any of the packages, the problem persists!!

The program 'java' can be found in the following packages:
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
Try: sudo apt-get install

Can any one tell me what does this mean and what is needed to be done to correct it, couldn't find much on internet about this!!

PS : i have executed sudo apt-get install openjdk-7-jre-headless and it tells that :

openjdk-7-jre-headless is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

so jre is there somewhere....what's the bug then?????

Why asking this question because eclipse is throwing this error and i need to fix jre/jdk to run it but i am total noob in this!!

A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
/usr/lib/eclipse/jre/bin/java
java in your current PATH

i was not able to login to my ubuntu account so asked the same question on SO first!!!

3
  • Eclipse is trying to find Java in another path. You need to tell us how you installed eclipse.
    – Braiam
    Jan 21, 2014 at 20:17
  • @Braiam : i just installed it using the software-center....it installed directly from there.
    – user238370
    Jan 22, 2014 at 16:10
  • 1
    Could you append the results of locate java | grep bin/java?
    – user.dz
    Jan 24, 2014 at 20:43

2 Answers 2

0

try running sudo apt-get install --reinstall openjdk-7-jre-headless

1
  • tried...this is what i got => Setting up openjdk-7-jre-headless (7u25-2.3.10-1ubuntu0.12.04.2) ... Loading classlist failed: No such file or directory ignoring dump failure Loading classlist failed: No such file or directory ignoring dump failure
    – user238370
    Jan 21, 2014 at 19:11
0

What I can suggest is to do the following.

Add Java 8 repository and get this version installed:

sudo add-apt-repository ppa:webupd8team/java 
sudo apt update 
sudo apt install openjdk-8-jdk 

check what is the current version on your system (which versions you have and which is a main one):

java -version

if you need a specific one, for example, Java 8 just installed, run:

 sudo update-alternatives --config java

and choose a version which you would like to use.

Let me know if this worked for you :)