fids@fids-NDiSM323:~$ java-version
java-version: command not found
fids@fids-NDiSM323:~$ java -versin
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>
fids@fids-NDiSM323:~$ sudo apt-get install default-jre
[sudo] password for fids:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package default-jre is a virtual package provided by:
oracle-java9-installer 9b111+9b111arm-1~webupd8~1
oracle-java8-installer 8u77+8u77arm-1~webupd8~4
oracle-java6-installer 6u45-0~webupd8~8
oracle-java7-installer 7u80+7u60arm-0~webupd8~1
You should explicitly select one to install.
E: Package 'default-jre' has no installation candidate
答案1
这里有拼写错误:
fids@fids-NDiSM323:~$ java -versin
一定是java -version
然后运行这个:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
要安装 Oracle JDK 8:
sudo apt-get install oracle-java8-installer
或者执行以下命令:
sudo apt-get install default-jre
这将安装 Java 运行时环境 (JRE)。如果您需要 Java 开发工具包 (JDK)(通常用于编译 Java 应用程序,例如 Apache Ant、Apache Maven、Eclipse 和 IntelliJ IDEA),请执行以下命令:
sudo apt-get install default-jdk
这就是安装 Java 所需的一切。
然后运行java -version