5

Does anybody know where JShell history is stored (Java-11/Open JDK on Windows-10, but any config might be useful)? I've been looking around in $HOME ($USERPROFILE, $APPDATA, ...). Is it file based?

JShell is JLine based, right? I indeed found $JAVA_HOME\legal\jdk.internal.le\jline.md.

halfer
  • 19,824
  • 17
  • 99
  • 186
jgran
  • 1,111
  • 2
  • 11
  • 21

2 Answers2

4

JShell uses PreferencesStorage, an implementation of PersistentStorage that is backed by a java.util.prefs.Preferences object. That means that the history is stored in a binary form and the location depends on the operating system. For example, on macOS you'll find the history (again, in binary form) in ~/Library/Preferences/com.apple.java.util.prefs.plist.

Martijn
  • 5,491
  • 4
  • 33
  • 41
4

On Windows, the history is stored in the registry, which can be opened with regedit. The path is HKEY_CURRENT_USER\Software\JavaSoft\Prefs\tool\/J/Shell

boneill
  • 1,478
  • 1
  • 11
  • 18