1

本文介绍下如何在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 run
INFO: Created user preferences directory.
|  Welcome to JShell -- Version 9-Debian
|  For an introduction type: /help intro

jshell> 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/bash
root@44d1d18351a8:/# java -version
openjdk 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)

doc


codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...