真所谓基础不牢,地动山摇,先补补Java基础知识吧
资料:Java官方入门教程 http://docs.oracle.com/javase/tutorial/getStarted/intro/index.html
![Figure showing MyProgram.java, compiler, MyProgram.class, Java VM, and My Program running on a computer.](https://i-blog.csdnimg.cn/blog_migrate/e1a7a4061096d1e4d01bbc91bf72ef8d.gif)
.class文件包含字节码(bytecodes)—— Java虚拟机的机器语言
java运行工具 (java.exe in %JAVA_HOME%/bin) 在一个Java虚拟机实例上执行应用程序。
Java平台 (Platform)
平台可被描述为操作系统与底层硬件的组合,如 Windows、Linux、Solaris OS。Java平台和大多数平台不同,它是运行在其他基于硬件的平台上的一个纯软件平台。Java平台包含两个组件:Java虚拟机 和 Java API
参考资料:Core Java Volume I Fundamentals 8th Edition, Chapter 2 The Java Programming Environment
#1. JDK vs JRE
#2. 设置环境变量:JAVA_HOME=XXX PATH=...;%JAVA_HOME%\bin
环境变量(Environment variable):are a set of dynamic named values that can affect the way running processes will behave on a computer. (wikipedia)
环境变量之 PATH: a list of directory paths. When the user types a command without providing the full path, this list is checked to see whether it contains a path that leads to the command. 说白了就是在cmd里面执行 java 命令时,OS除了会在当前目录寻找 java.exe,当找不到时还会去PATH指定的路径下去寻找。
http://docs.oracle.com/javase/tutorial/getStarted/intro/index.html