JDK安装步骤
下载
JDK官网下载
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
| Windows x64 | 211.58 MB | [jdk-8u202-windows-x64.exe](javascript: void(0)) |
安装
1.下载后安装
2.配置环境变量
3.java -version运行证明安装成功
JAVA_HOME
C:\Program Files\Java\jdk1.8.0_202\bin
CLASSPATH
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tool.jar;
前三行
C:\Program Files\Java\jre\jre1.8.0_202\bin
%JAVA_HOME%\bin;
C:\Program Files\Java\jdk1.8.0_202\bin
最后一行
C:\Program Files\Java\jre\jre1.8.0_202\bin
敲代码
public class Hello{
public static void main (String args[]) {
System.out.println("大家好");
System.out.println("Nice to meet you");
Student stu =new Student ( );
stu.speak("We are students");
}
}
class Student {
public void speak (String s) {
System.out.println(s);
}
}
编译&运行过程
1.打开cmd运行代码
2.cd Desktop\JAVA
3.javac Hello.java
4.java Hello
最后成功运行的截图