JDK11 ea18ãããjavacããªãã§ãJavaãã¡ã¤ã«ãå®è¡ã§ããããã«ãªãã¾ããã
ãã¨ãWindowsãã¤ããªã¯zipãã¡ã¤ã«ã§æä¾ãããããã«ãªã£ã¦ãã¾ããtarã³ãã³ããæä¾ãããã¨ã¯ãããã¨ã¯ã¹ããã¼ã©ã¼ãã解åã§ããzipãã¡ã¤ã«ã«ãªãã®ã¯ ãããããã
JDK 11 Early-Access Builds
JEP330ãåãè¾¼ã¾ãããã¨ã«ãããã½ã¼ã¹ãã¡ã¤ã«ãã²ã¨ã¤ã®Javaããã°ã©ã ã¯ãjavacä¸è¦ã§javaã³ãã³ãã§å®è¡ã§ããããã«ãªãã¾ãã
JEP 330: Launch Single-File Source-Code Programs
Windowsã®ã³ãã³ãããã³ããã 㨠ãããªæãã
C:\Users\naoki\java>more Hello.java public class Main { public static void main(String... args) { System.out.println("Hello!!"); } } C:\Users\naoki\java>jdk-11-ea18\bin\java Hello.java Hello!!
ããã¯ã¤ã³ã¿ããªã¿ã®ããã«é次ã½ã¼ã¹ã³ã¼ããèªã¿ãªããå®è¡ããã¨ããããã§ã¯ãªããå
é¨çã«ã¯ã次ã®ããã«ã¡ã¢ãªã«åºåãã¦ã³ã³ãã¤ã«ãè¡ããããã®ã¡ã¢ãªå
容ãå®è¡ãããããªå¦çã«ãªã£ã¦ãã¾ãã
javac -d <memory> Hello.java java -cp <memory> Main
ããã§æ³¨ç®ãã¦ãããããã®ã¯ããã¡ã¤ã«åã¨ã¯ã©ã¹åãä¸è´ãã¦ããªãã¨ããã§ãã
ãã ãããã§ã«ã¯ã©ã¹ãã¹ä¸ã«ã³ã³ãã¤ã«æ¸ã¿classãã¡ã¤ã«ãããå ´åã¯ã¨ã©ã¼ã«ãªãã¾ãã
C:\Users\naoki\java>jdk-11-ea18\bin\java Hello.java error: class found on application class path: Main
æ¡å¼µåjavaãä»ããªãå ´åã§ãã--sourceæå®ãããã°ç´æ¥å®è¡ãã§ãã¾ãã
C:\Users\naoki\java>more hello public class Main { public static void main(String... args) { System.out.println("Hello!!"); } } C:\Users\naoki\java>jdk-11-ea18\bin\java --source 11 hello Hello!!
ãããå©ç¨ããã¨ãShebangã¨ãã¦Javaãã¡ã¤ã«ãã³ãã³ãã®ããã«å®è¡ãããã¨ãã§ãã¾ããCygwinã§ããã次ã®ããã«ãªãã¾ããã
naoki@DESKTOP-P96N9VS ~$ cat hello #! /cygdrive/c/Users/naoki/java/jdk-11-ea18/bin/java --source 11 public class Main { public static void main(String... args) { System.out.println("Hello!!"); } } naoki@DESKTOP-P96N9VS ~$ ls hello -l -rwxr-xr-x 1 naoki naoki 171 6æ 17 17:50 hello naoki@DESKTOP-P96N9VS ~$ ./hello Hello!!
Javaãå°ãæ°è»½ã«å®è¡ã§ããããã«ãªãã¾ãããå
¥éã«ã¯ ã¨ã¦ãããã¨æãã¾ãã