因为在国外上学所以锻炼一下自己的英文水平啦,用英文记录Java 学习的过程。
1. Java is Platform Independent.
It can be executed in multiple platforms(Windows,Linux or OSX), while a Windows C++ compiled file can be only executed inWindows.
2. How does Java compiler works?
javac MyProgram.java java MyProgram.class
javac (JavaProgramming Language Compiler)is a tool in JDK/bin to compile Java
source code intobytecode class files.
3. JDK, JRE & JVM
JDK(Java Development Kit) is used to develop andit has four folders, bin, include, lib, jre.
- bin: compiler (javac.exe) to compile .java into .class
- include: head files between java and JVM
- lib: libraries
- jre: JRE
JVM(Java Virtual Machine) to execute .class files.The .class file is not executed directly in platforms but in virtual machinesprovided by JDK. Therefore, it can ignore the platform (OperatingSystems) differences.
JRE(Java Runtime Environment) has two folders, binand lib and they are different from above folders. When JVM interpret .classfiles, it has to call the needed libraries which JRE provides.
- bin: JVM
- lib: the necessary libraries for JVM
p.s. you can package .class file with jre folderto your friends and he can use it to run your program.