First, Tomcat
Dynamic site:
Run the program
Service side:
Client:
Compile once, run everywhere
Components of Java technology:
Java programming language
Java class file format
Java API
Java VMS
Java compile-time environment:
Source code:. java
A.java, B.java, C.java---java compiler (JAVAC)--A.class, B.class, C.class
Runtime Environment for Java:
A.class, B.class, C.class, JVM <--object.class, String.class, ...
Components of a Java VM:
Java class loader (Java ClassLoader)
Java Execution engine
Features of the Java language:
Process oriented:
Take command as the core
Object-oriented: data as the core
How the JVM is implemented:
1, one-time interpreter, interpret bytecode and execute;
2. Timely compiler (Just-in-time complier)
Dependent on more memory cache interpretation results
3. Self-adapting compiler
Cache around 20% code to improve speed by around 80%
JDK=JAVA+API+JVM, a minimal environment for Java program development,
Jre=jvm+java SE API:
Second, the Java architecture consists of four independent but related technologies:
Java programming language
Java class file format
Java API
Java VMS
Compile the source code in the Java language, compile it into a Java class file, then run the class file in the Java VM, and when you write the program, access the system resources by invoking the methods in the class (Java API), and when the program runs, It also satisfies the Java API Call of the program by invoking a method that implements the Java API in the class file. Java VMS and Java APIs form a "platform" in which all Java programs are compiled and run, so they are sometimes referred to as the Java Runtime environment.
The primary task of a Java VM is to load a class file and execute the bytecode within it. The Java VM contains a class loader, which can load class files from programs and APIs, while the Java API's classes are loaded only when they are needed in the execution of a program.
Java bytecode is executed by the execution engine. In different Java VMS, implementations of their execution engines may vary. The simplest execution engine is not a one-time explanation of bytecode, while another execution engine called an "instant compiler (Just-in-time compiler)" executes faster, but consumes more memory resources. In real-time compilation mode, the first byte code executed is compiled and cached for "reuse" by the machine code. The third execution engine is the so-called Adaptive Optimizer, in which the virtual machine interprets the bytecode, which is the activity that monitors the running program and records the most frequently used code. While the program is running, the virtual machine compiles only the code that is most frequently active, and the code that is not frequent is still reserved for bytecode execution by the virtual machine. The Adaptive optimizer allows the Java VM to execute the optimized native code in 80%-90% of the time, and only needs to compile 10%-20% code that has an impact on performance. The last virtual machine consists of a hardware chip, which executes Java bytecode in a local way, and its execution engine is embedded in the chip.
Third, install the main step gather
1. Prepare version software
[Email protected] tomcat]# lsapache-tomcat-8.0.29 jdk-8u66-linux-x64.gz
2. Decompression
[Email protected] tomcat]# tar jdk-8u66-linux-x64.gz
[Email protected] tomcat]# tar apache-tomcat-8.0.29.tar.gz
3. Specify a soft link to the/usr/local
[Email protected] tomcat]# ln-s/root/tomcat/apache-tomcat-8.0.29/usr/local/tomcat
[Email protected] tomcat]# ln-s/ROOT/TOMCAT/JDK1.8.0_66/USR/LOCAL/JDK
4. Configuring the Java Environment
[Email protected] tomcat]# vim/etc/profile.d/jdk.sh #jdk8 settingsjava_home=/usr/local/jdkjre_home= $JAVA _home/ Jrepath= $PATH: $JAVA _home/bin: $JRE _homeclasspath=: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/ Libexport java_home jre_home PATH CLASSPATH
[Email protected] tomcat]# source/etc/profile.d/jdk.sh
See if it's successful
[[email protected] tomcat]# Java-versionjava version "1.8.0_66" Java (TM) SE Runtime Environment (build 1.8.0_66-b17) Java H Otspot (TM) 64-bit Server VM (build 25.66-b17, Mixed mode)
5. Configuring the Startup startup script for Tomcat
[[email protected] bin]# vim /etc/init.d/tomcat#!/bin /sh# tomcat init script for linux.## chkconfig: 2345 96 14# Description: the apache tomcat servlet/jsp container. java_opts= '-xms64m -xmx128m ' java_home=/usr/java/jdkcatalina_home=/usr/local/tomcatexport java_home catalina_homecase $1 instart) exec $CATALINA _home/bin/ catalina.sh start;; Stop) exec $CATALINA _home/bin/catalina.sh stop;; Restart) $CATALINA _home/bin/catalina.sh stop sleep 2 exec $CATALINA _home/bin/catalina.sh start ;; *) echo "Usage: ' basename $0 ' {start|stop|restart}" exit 1 ;; esac~
Start Tomcat
[Email protected] bin]#/etc/init.d/tomcat startusing catalina_base:/usr/local/tomcatusing catalina_home:/usr/local /tomcatusing catalina_tmpdir:/usr/local/tomcat/tempusing jre_home:/usr/local/jdk/jreusing CLASSPATH:/usr/l Ocal/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jartomcat started.
[[email protected] bin]# netstat -tlnp | grep javatcp 0 0 :::8080 :::* LISTEN 4464/java tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 4464/java tcp 0 0 :::8009 :::* listen 4464/java
6. Open Test
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/77/12/wKiom1ZiW5rSLrGmAAc5f-8Yexs317.jpg "title=" 1.jpg " alt= "Wkiom1ziw5rslrgmaac5f-8yexs317.jpg"/>
Tomcat Deployment installation Step-up