Home > Java > javaTutorial > body text

Example analysis of how java9 runs in docker

黄舟
Release: 2017-09-28 09:31:11
Original
1341 people have browsed it

最近在学习java9,所以将学习中遇到的一些知识点分享给大家,下面这篇文章主要给大家介绍了java9学习系列之在docker中如何运行java9的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考下。

前言

本文将给大家详细介绍下如何在docker中运行java9的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧。

镜像


docker pull openjdk:9-jdk
Copy after login

启动


docker run -it openjdk:9-jdk /bin/jshell
Copy after login

然后就可以正常使用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
Copy after login

退出


jshell> /exit
| Goodbye
Copy after login

查看此镜像的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)
Copy after login

总结

doc

Start using Java 9 shell — jshell with docker

The above is the detailed content of Example analysis of how java9 runs in docker. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template