且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何安装java7和java 8?

更新时间:2023-01-15 07:49:30

您可以在计算机上安装任意数量的 JDK 实例(并在项目中使用它们)或工具),但只有一个可以作为主要使用 JAVA_HOME env变量,并且应该添加 bin dir到 PATH 的值,如%JAVA_HOME%\ bin

You can install any number of JDK instances on your computer (and use them in projects or tools), but only one can be used as the main with JAVA_HOME env variable and its bin dir should be added to the PATH value like %JAVA_HOME%\bin.

JAVA_HOME 位置来检测 JDK 位置和二进制文件目录> PATH 允许您在终端或直接电话中使用 JDK 等应用,例如 javac 从任何地方

JAVA_HOME location is used by most software to detect default JDK location and binaries dir in PATH allows you to use JDK apps like javac in the terminal or by direct calls from anywhere

如果一切正确,那么您应该在终端中看到所需的java版本,只需输入:

If everything is correct then you should see desired java version in terminal just typing:

C:\Users\Admin>%JAVA_HOME%/bin/java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)   

Linux,Mac OS X或Win安装略有不同,但您可以在 Oracle网站

Linux, Mac OS X or Win installations slightly differ from each other, but you can find all the necessary instructions at the Oracle site.