The following command will return a list of all packages directly related to Java. They will be in the format of java-<version>
.
$ yum search java | grep 'java-'
If there are no available packages, then you may need to download a new repository to search through. I suggest taking a look at Dag Wieers' repo. After downloading it, try the above command again.
You will see at least one version of Java packages available for download. Depending on when you read this, the lastest available version may be different.
java-1.7.0-openjdk.x86_64
The above package alone will only install JRE. To also install javac
and JDK, the following command will do the trick:
$ yum install java-1.7.0-openjdk*
These packages will be installing (as well as their dependencies):
java-1.7.0-openjdk.x86_64
java-1.7.0-openjdk-accessibility.x86_64
java-1.7.0-openjdk-demo.x86_64
java-1.7.0-openjdk-devel.x86_64
java-1.7.0-openjdk-headless.x86_64
java-1.7.0-openjdk-javadoc.noarch
java-1.7.0-openjdk-src.x86_64
@Sventeck, perfecto.
redhat docs are always a great source - good tutorial that explains how to install JDK via yum and then setting the path can be found here (have fun!) - Install OpenJDK and set $JAVA_HOME path
OpenJDK 6:
yum install java-1.6.0-openjdk-devel
OpenJDK 7:
yum install java-1.7.0-openjdk-devel
To list all available java openjdk-devel packages try:
yum list "java-*-openjdk-devel"
yum install java-1.8.0
and then:
alternatives --config java
and check:
java -version
On centos 7, I just do
sudo yum install java-sdk
I assume you have most common repo already. Centos just finds the correct SDK with the -devel sufix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With