下載JDK
從oracle官方網站下載並安裝JDK.java
下載使用文檔
從oracle官方網站下載使用幫助文檔.oracle
安裝庫源文件
源文件位於安裝目錄的 /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/lib/src.zip網站
mac-abeen:~ abeen$ /usr/libexec/java_home -V //已安裝JDK Matching Java Virtual Machines (3): 9.0.4, x86_64: "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home 1.8.0_66, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home 1.8.0_65, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home //默認使用JDK /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
mac-abeen:~ abeen$ java -version java version "9.0.4" Java(TM) SE Runtime Environment (build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode) mac-abeen:~ abeen$ javac -version javac 9.0.4
建立Welcome.java源文件ui
mac-abeen:java abeen$ /** * This program dispalys Hello World * @version 1.0 * @author ABeen * */ public class Welcome { public static void main(String[] args) { String greeting = "Hello World!"; System.out.println(greeting); } }
編譯並執行spa
mac-abeen:java abeen$ javac Welcome.java mac-abeen:java abeen$ java Welcome Hello World!