序
本文介绍下如何在docker运行java9
镜像
docker pull openjdk:9-jdk
启动
docker run -it openjdk:9-jdk /bin/jshell
然后就可以正常使用jshell了,比如
Sep 22, 2017 2:16:12 AM java.util.prefs.FileSystemPreferences$1 runINFO: Created user preferences directory.| Welcome to JShell -- Version 9-Debian| For an introduction type: /help introjshell> Arrays.asList(1,2,3,4).stream().limit(3).forEach(e -> System.out.print(e))123
退出
jshell> /exit| Goodbye
查看此镜像的java版本
docker run -it openjdk:9-jdk /bin/bashroot@44d1d18351a8:/# java -versionopenjdk version "9-Debian"OpenJDK Runtime Environment (build 9-Debian+0-9b181-4)OpenJDK 64-Bit Server VM (build 9-Debian+0-9b181-4, mixed mode)