How (or in which file) does JShell store its configuration settings?

时间:2018-02-05 13:02:15

标签: java jshell

The doc says:

Remember that the startup scripts are loaded into the current session only when the state is reset. The contents of the script is stored, not a reference to the script.

(https://docs.oracle.com/javase/9/jshell/scripts.htm#JSHEL-GUID-AC2A6582-6A9A-48B1-ABBF-4C9536CDFD07)

For example,

/set start -retain mystartscript.jsh

But where does it store the contents of mystartscript.jsh?

1 个答案:

答案 0 :(得分:0)

像在示例中一样使用相对文件名:

/set start -retain mystartscript.jsh

JShell会在[ mystartscript.jsh ] / user.home

中寻找mystartscript.jsh

您也可以给它一个绝对的文件路径:

/set start -retain /my_custom_jshell_scripts/mystartscript.jsh

Robert Field(JShell的首席设计师)解释了this tutorial如何( re )设置/取消设置JShell内置的DEFAULT启动脚本以及自定义的{{1} }启动脚本。