29

I am new to centos and linux systems. I have downloaded both jdk-6u35-linux-x64.bin and .rpm.bin but neither of them is giving me .rpm file to install nor .bin is executing by itself

i have tried commands like ./ jdk..... .bin and gunzip for .tar files

Can anyone kindly tell me few steps to install jdk1.6 in centos 6.5(Final) 64 bit machine with suitable download link

2

4 Answers 4

65

There are JDK versions available from the base CentOS repositories. Depending on your version of CentOS, and the JDK you want to install, the following as root should give you what you want:

OpenJDK Runtime Environment (Java SE 6)

yum install java-1.6.0-openjdk

OpenJDK Runtime Environment (Java SE 7)

yum install java-1.7.0-openjdk

OpenJDK Development Environment (Java SE 7)

yum install java-1.7.0-openjdk-devel

OpenJDK Development Environment (Java SE 6)

yum install java-1.6.0-openjdk-devel

Update for Java 8

In CentOS 6.6 or later, Java 8 is available. Similar to 6 and 7 above, the packages are as follows:

OpenJDK Runtime Environment (Java SE 8)

yum install java-1.8.0-openjdk

OpenJDK Development Environment (Java SE 8)

yum install java-1.8.0-openjdk-devel

There's also a 'headless' JRE package that is the same as the above JRE, except it doesn't contain audio/video support. This can be used for a slightly more minimal installation:

OpenJDK Runtime Environment - Headless (Java SE 8)

yum install java-1.8.0-openjdk-headless
4
  • 1
    On CentOS 6.5 I had to run jum install java-1.7.0-openjdk java-1.7.0-openjdk-devel. Without both the jdk and jdk development kit it will not run from the startup shell script. Aug 9, 2014 at 16:01
  • yes yum install does intall open jdk but i have to run glassfish on the top of this jdk will this give any problem ... in fact i have not tried much but its not working now.. Aug 14, 2014 at 11:29
  • @NavinRajPandey that sounds like a different question, I'd recommend opening a new question for it.
    – grdryn
    Aug 14, 2014 at 12:04
  • One has to be mindful of the alternatives for java-related commands other than the main java command. Perform ls -l /etc/alternatives and check. As far as I can recall (would have to remove then reinstall to double check) the alternatives were not all set to point to the new JDK8 for all utility commands until I also installed the openjdk-devel package. Sep 19, 2016 at 1:55
38

I advise you to use the same JDK as you may use with Windows: the Oracle one.

http://www.oracle.com/technetwork/java/javase/downloads/index.html
Go to the Java SE 7u67 section and click on JDK7 Download button on the right.

On the new page select the option "(¤) Accept License Agreement"
Then click on jdk-7u67-linux-x64.rpm

On your CentOS, as root, run:

$ rpm -Uvh jdk-7u67-linux-x64.rpm
$ alternatives --install /usr/bin/java java /usr/java/latest/bin/java 2

You may already have a Java 5 installed on your box... before installing the downloaded rpm remove previous Java by running this command yum remove java

3
  • 1
    finally I have intalled the oracle java and glassfish is also doing fine on it .. will look forward to try open jdk as well @Destroyica thank you for remove command should have tried it earlier stuck me for long Aug 15, 2014 at 15:40
  • 1
    mine refused to install (saying it already was) until I did rpm -e jdk prior to trying again if that helps anyone
    – Hashbrown
    Dec 9, 2014 at 6:23
  • 2
    The download can be completed from your shell:wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.rpm before rpm. You can as well validate with sudo alternatives --config java if you have Java already installed and which version is active. And you may need to run chmod a+x jdk-8u66-linux-x64.rpm
    – Sergey V.
    Dec 7, 2015 at 5:20
6

Try the following to see if you have the proper repository installed:

# yum search java | grep 'java-'

This is going to return a list of available packages that have java in the title. Specifically we are interested in the java- anything, as the jdk will typically be in 'java-version#' type format... Anyhow, if you have to install a repo look at Dag Wieers repo:

http://dag.wieers.com/rpm/FAQ.php#B

After you've got it installed try yum search again... This time you'll have a bunch of java stuff.

# yum search java | grep 'java-'

This will return the list of the available java packages. You can install one like this:

# yum install java-1.7.0-openjdk.x86_64
2

Here is something that might help. Use the root privileges. if you have .bin then simply add the execution permission to the bin file.

chmod a+x jdk*.bin

next step is to run the .bin file which is simply

./jdk*.bin in the location you want to install.

you are done.

1
  • Thank you i was missing the chmod a+x part .. Thanks a lot Jan 4, 2014 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.