可以使用Java 9 jshell在另一个JVM中运行代码吗? [英] Can the Java 9 jshell be used to run code in another JVM?

查看:151
本文介绍了可以使用Java 9 jshell在另一个JVM中运行代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java 9有一个Java的read-eval-print循环,名为 jshell 。我从命令行看到它的基本模式。它还可以用于远程过程吗?换句话说,我可以连接到另一个Java进程并输入代码片段以在该运行时内运行吗?这将是一个很好的方法来更改应用服务器中的配置状态,而无需编写带有UI的管理工具。

Java 9 has a read-eval-print loop for Java, called jshell. I've seen it work in it's basic mode, from the command line. Can it also be used in a remote process? In other words, can I connect to another Java process and enter code snippets to run within that runtime? This would be a nice way to change configuration state in an app server without having to write an admin tool with a UI.

推荐答案

简单的答案是否定的,没有办法将jshell附加到正在运行的Java进程。 jshell是一个在自己的JVM中运行的独立应用程序。

The simple answer is no, there is no way to attach jshell to a running Java process. jshell is a standalone app that runs in its own JVM.

这篇关于可以使用Java 9 jshell在另一个JVM中运行代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆