I was trying to install java JRE7 this earlier. I followed the instructions Mike 2000 17 linkedd in another linux thread. In the installation stage of the setup it said to put this into the terminal:

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

I did that and let sudo work. It said to check to see if it sucessfully downloaded by typing this into the terminal:

java -version

It was supposed to say something like this:

java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

But it said this:

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

I have no idea what to do. It did not work and I can't use it. If anyone can help me that would be great.

Recommended Answers

All 3 Replies

First thing's first, did you notice the update on the instruction website:

quote:

Update 2: the installer now requires you accept the Oracle license before the installation begins. This is only required once. If for some reason you need the installation to be automated, you can run the following command to automatically accept the Oracle license:

$ sudo echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

end quote.

The easiest is, by far, to simply install openjdk-7 instead of the Oracle version. So, the first thing is to make sure that you absolutely need oracle-java and cannot live with openjdk instead. The two are just two different implementations of the same library (one open-source, the other not).

It is very possible that the installation succeeded, but failed to create the final links such that you can actually run java command.

The first thing to try is running this command:

$ locate javac

which might output a whole bunch of stuff (depending on if you installed openjdk before or not), and somewhere in that stuff, you should find something related to oracle-java. For example, I have the previous version (6) installed (from some time back), which was from Sun (old name), and this is part of what I find in the output of the locate command:

/usr/bin/javac
/usr/lib/jvm/java-1.5.0-gcj-4.6/bin/javac
/usr/lib/jvm/java-1.5.0-gcj-4.6/man/man1/javac.1
/usr/lib/jvm/java-1.5.0-gcj-4.7-amd64/bin/javac
/usr/lib/jvm/java-1.5.0-gcj-4.7-amd64/man/man1/javac.1
/usr/lib/jvm/java-6-openjdk-amd64/bin/javac
/usr/lib/jvm/java-6-openjdk-amd64/man/ja_JP.eucJP/man1/javac.1.gz
/usr/lib/jvm/java-6-openjdk-amd64/man/man1/javac.1.gz
/usr/lib/jvm/java-6-sun-1.6.0.26/bin/javac
/usr/lib/jvm/java-6-sun-1.6.0.26/man/ja/man1/javac.1.gz
/usr/lib/jvm/java-6-sun-1.6.0.26/man/man1/javac.1.gz
/usr/lib/jvm/java-7-openjdk-amd64/bin/javac
/usr/lib/jvm/java-7-openjdk-amd64/man/ja_JP.UTF-8/man1/javac.1.gz
/usr/lib/jvm/java-7-openjdk-amd64/man/man1/javac.1.gz

As you can see, there are a number of java installs on my computer, including gcj4.6, gcj4.7, openjdk-6, openjdk-7, and sun-java-6. They each provide their own javac application. What you are definitely missing is /usr/bin/javac because if you had that, it would work (running java or javac directly). But you should definitely be able to find something like /usr/lib/jvm/java-7-oracle... /javac. If you can't find this, then your installation failed completely (and I don't really know what else to suggest besides trying it again).

If you can find this, then your installation worked, but not quite to the end. I would first try to complete the steps by also running this:

$ sudo update-java-alternatives -s java-7-oracle

and then, run this:

$ sudo apt-get install oracle-java7-set-default

If that doesn't fix it, you will probably have to attempt the installation again, and be sure to check the output carefully, because error messages are easily missed.

I could give you further instructions to "fix up" a partially broken installation, but this is tricky and long to do, so I will wait for further confirmation.

Thank you for all of your help and advice. I just downloaded openJDK and it is running sucessfully.

Member Avatar for iLikePHP

If it's for playing games, such as minecraft etc... I usually use

sudo apt-get install default-jdk
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.