CentOS 的 Java JRE 更新问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32384019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java JRE Updating issue with CentOS
提问by Justin J. O'Boyle
I have just recently installed CentOS on my little server box. I am in the process of transferring my servers from Windows Server to Linux/CentOS, and I'm running into a small problem.
我最近刚刚在我的小服务器上安装了 CentOS。我正在将我的服务器从 Windows Server 转移到 Linux/CentOS,但遇到了一个小问题。
I checked "Install java" when I was installing CentOS because I thought it would speed up the process. However, it installed Java 7, and I need to use Java 8 because our code uses a bunch of new features in Java 8.
我在安装 CentOS 时选中了“安装 java”,因为我认为它会加快进程。但是,它安装了 Java 7,我需要使用 Java 8,因为我们的代码使用了 Java 8 中的一堆新功能。
I have tried removing Java JRE 7 manually, downloading an rpm, and using yum
. However, it seems that Java 7 is still installed, or is overriding the Java JRE 8 install.
我尝试手动删除 Java JRE 7、下载 rpm 并使用yum
. 但是,似乎仍然安装了 Java 7,或者覆盖了 Java JRE 8 安装。
I can provide any logs neccessary. Thank you!
我可以提供任何必要的日志。谢谢!
rpm -qa 'java*'
rpm -qa 'java*'
java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.el7_0.x86_64
javapackages-tools-3.4.1-6.el7_0.noarch
回答by Lars Gendner
Here is what I did on my CentOS7 box:
这是我在 CentOS7 机器上所做的:
yum list installed java*
sudo yum remove java-1.7.0-openjdk java-1.7.0-openjdk-headless
Then I downloaded the JDK RPM from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html(I chose jdk-8u60-linux-x64.rpm). Then installed it using
然后我从Oracle下载了JDK RPM:http: //www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html(我选择了jdk-8u60-linux-x64.rpm)。然后使用安装它
sudo yum localinstall jdk-8u60-linux-x64.rpm
For me that worked. To track down your java
binary, you can do it like this:
对我来说有效。要跟踪您的java
二进制文件,您可以这样做:
[~]$ which java
/usr/bin/java
[~]$ ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 3. Sep 02:49 /usr/bin/java -> /etc/alternatives/java
[~]$ ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 34 3. Sep 02:49 /etc/alternatives/java -> /usr/java/jdk1.8.0_51/jre/bin/java
If your Java binary is linked in /etc/alternatives, you can use alternatives(8)to choose the desired version.
如果您的 Java 二进制文件链接在 /etc/alternatives 中,您可以使用Alternatives(8)来选择所需的版本。