A) JDK Introduction
1.JDK Java SE Development kit (JDK) java Development Kit
JDK stands for Java SE Development kit (JDK), namely java Development Kit Standard Edition, Oracle provides a set of development kit for developing java application that provides the compiler, tools and resources needed to run java program, including java compiler, java runtime environment, as well as common java class libraries.
(1) JRE Java Runtime Environment (JRE) Java Runtime Environment
Java Runtime Environment, which stands for Java Runtime Environment (JRE), is also known as JRE, which is a necessary condition to run the java.
(2)JVM Java Virtual Machine
Java Virtual Machine, JRE included JVM. JVM program is run java virtual machine core, but also other class loader, bytecode verifier, and a large number of basic libraries. In addition to containing JRM JVM, but also includes other environmental support to run java program.
a. What is the JAVA virtual machine
called a virtual machine is a virtual machine. He is a software used to perform a series of virtual computer instructions. In general, the virtual machine can be divided into system virtual machine and virtual machine. Famous VisualBox, VMware virtual machines belong to the system. They are completely simulate the physical computer. It provides a complete operating system can run software platform.
A typical representative of a virtual machine is a Java virtual machine, it is designed for a computer program designed to perform a single instruction execution in a Java virtual machine, we called Java bytecode instructions. Whether the system is a virtual machine or virtual machine program, the software running on top of virtual machines have limited resources provided.
How do c.JAVA cross-platform
with a JAVA program (a collection of JAVA bytecode), by JAVA virtual machine (JVM) running on the major mainstream operating system platforms such as Windows, CentOS, Ubuntu and so on. Program to the virtual machine as an intermediary to achieve cross-platform.
(3)
common virtual machine parameters
1, the standard parameters
2, X type parameter
3, XX type parameter
在实际情况中 X 参数和 XX 参数并没有什么不同。X 参数的功能是十分稳定的。
用一句话来说明 XX 参数的语法。所有的 XX 参数都以"-XX:"开始,但是随后的语法不同,取决于参数的类型:
1)对于布尔类型的参数,我们有"+"或"-",然后才设置 JVM 选项的实际名称。
例如,-XX:+ 用于激活选项,而 -XX:- 用于注销选项。
Example:
开启GC日志的参数: -XX:+PrintGC
2) 对于需要非布尔值的参数,如 string 或者 integer,我们先写参数的名称,后面加上"=",最后赋值。
例如: -XX:MaxPermSize=2048m
(4)
common JVM parameters
Tracking garbage collection JAVA virtual machine
GC logs: jvm garbage collection, recording operational status of jvm, memory overflow error message oom and so on.
- % T time string will be replaced as the format: YYYY-MM-DD_HH-MM-SS
Open GC logs:
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/data0/logs/gc-%t.log"
Configure heap space JAVA virtual machine
-Xms:初始堆大小
-Xmx:最大堆大小
实际生产环境中, 我们通常将初始化堆(-Xms) 和 最大堆(-Xmx) 设置为一样大。以避免程序频繁的申请堆空间。设置为物理内存的一半。
JAVA virtual machine configuration permanent zone (zone method)
-XX:PermSize 内存永久保留区域 ://所占用的内存是堆内存的一部分内存,不能超过堆内存
-XX:MaxPermSize 内存最大永久保留区域
There are various versions of the look they need here I downloaded version 8
Here you need to register an account in order to download click on it will automatically go to the registered account
after clicking Login registration number
and will automatically pop up a download interface
Click to download
Some may go directly to the official website
here and just entering the interface
Here you click to download and then he will download
this is the case is not logged in can not be downloaded directly displayed
After a good start the installation download
deploy
[root@java-tomcat1 ~]# tar xzf jdk-8u211-linux-x64.tar.gz -C /usr/local/
[root@java-tomcat1 ~]# cd /usr/local/
[root@java-tomcat1 local]# mv jdk1.8.0_191/ java
设置环境变量:
[root@java-tomcat1 local]# vim /etc/profile
export JAVA_HOME=/usr/local/java #指定java安装目录
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH #用于指定java系统查找命令的路径
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar #类的路径,在编译运行java程序时,如果有调用到其他类的时候,在classpath中寻找需要的类。
检测JDK是否安装成功:
[root@java-tomcat1 local]# source /etc/profile
[root@java-tomcat1 local]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)