简体   繁体   English

JShell如何(或在哪个文件中)存储其配置设置?

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

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 ) 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 ? 但是它将mystartscript.jsh的内容存储在哪里

Using a relative filename like you do in your example: 像在示例中一样使用相对文件名:

/set start -retain mystartscript.jsh

JShell would look for mystartscript.jsh in [ user.home ]/ mystartscript.jsh JShell会寻找mystartscript.jsh在[ user.home ] / mystartscript.jsh

You could also give it an absolute file path: 您也可以给它一个绝对的文件路径:

/set start -retain /my_custom_jshell_scripts/mystartscript.jsh

Robert Field—the JShell lead architect—explains in this tutorial how to ( re )set/unset JShell's built-in DEFAULT startup scripts plus custom .jsh startup scripts. JShell的首席架构师Robert Field在本教程中介绍了如何( 重新 )设置/取消设置JShell的内置DEFAULT启动脚本以及自定义.jsh启动脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM