在 Ubuntu 上安装 Java 7 [英] Installing Java 7 on Ubuntu

查看:29
本文介绍了在 Ubuntu 上安装 Java 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装java我一直使用终端的经典方式.我想手动安装java.我将 JDK 的文件夹放在桌子上,并设置了环境变量(PATH、CLASSPATH 和 JAVA_HOME).从终端,如果我输入 java -version 我得到打印

to install java I have always used the classic way from the terminal. I would like to install java manually. I placed the folder of the JDK on the desk and I set environment variables (PATH, CLASSPATH and JAVA_HOME). From the terminal, if I type java -version I get printed

foralobo@ubuntu-vincy:~$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

但是当我尝试安装eclipse或netbeans时,系统警告说机器上没有安装java.

But when I try to install eclipse or netbeans, the system warns by saying that there is no java installed on the machine.

手动安装缺少什么?(Ubuntu 13.04)

What is missing to compleatare manual installation? (Ubuntu 13.04)

推荐答案

这个答案用于描述如何安装 Oracle Java 7.自从 Oracle 终止 Java 7 并将带有安全补丁的版本的二进制下载放在付费墙之后,这不再有效.此外,OpenJDK 已经成长起来,现在是一个更可行的替代方案.

This answer used to describe how to install Oracle Java 7. This no longer works since Oracle end-of-lifed Java 7 and put the binary downloads for versions with security patches behind a paywall. Also, OpenJDK has grown up and is a more viable alternative nowadays.

在 Ubuntu 16.04 及更高版本中,Java 7 不再可用.通常你最好安装 Java 8(或 9).

In Ubuntu 16.04 and higher, Java 7 is no longer available. Usually you're best off installing Java 8 (or 9) instead.

sudo apt-get install openjdk-8-jre

或者,如果您还需要编译器,请获取 jdk:

or, f you also want the compiler, get the jdk:

sudo apt-get install openjdk-8-jdk

在 Trusty 中,目前安装 Java 7 最简单的方法是安装 OpenJDK 包:

In Trusty, the easiest way to install Java 7 currently is to install OpenJDK package:

sudo apt-get install openjdk-7-jre

或者,对于 jdk:

sudo apt-get install openjdk-7-jdk

如果您专门在不再支持的 Ubuntu 版本上寻找 Java 7,请参阅 https://askubuntu.com/questions/761127/how-do-i-install-openjdk-7-on-ubuntu-16-04-or-higher .

If you are specifically looking for Java 7 on a version of Ubuntu that no longer supports it, see https://askubuntu.com/questions/761127/how-do-i-install-openjdk-7-on-ubuntu-16-04-or-higher .

这篇关于在 Ubuntu 上安装 Java 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆