Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where does jshell save things

76 views
Skip to first unread message

Cecil Westerhof

unread,
Jul 29, 2019, 3:14:12 PM7/29/19
to
When I start jshell it remembers the history from previous runs. Where
is this saved?

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Arne Vajhøj

unread,
Jul 29, 2019, 7:54:29 PM7/29/19
to
On 7/29/2019 2:59 PM, Cecil Westerhof wrote:
> When I start jshell it remembers the history from previous runs. Where
> is this saved?

I believe it uses preferences API.

So it is OS specific.

Windows => registry

*nix => $HOME/.java dir

Arne

Cecil Westerhof

unread,
Jul 30, 2019, 1:44:12 AM7/30/19
to
I already thought about that, but in ~/.java I saw only a fonts
directory. Looking better there is also an .userPrefs directory.
(First time I see a hidden directory in a hidden directory.) The file
I need is:
~/.java/.userPrefs/tool/JShell/prefs.xml

I do not like that it is XML, but it is what it is.

Eric Sosman

unread,
Jul 30, 2019, 7:11:56 AM7/30/19
to
On 7/30/2019 1:28 AM, Cecil Westerhof wrote:
> [...] The file
> I need is:
> ~/.java/.userPrefs/tool/JShell/prefs.xml
>
> I do not like that it is XML, but it is what it is.

Since you're using a Unixoid system, just construct a named
pipe that connects to an XML-to-JSON and JSON-to-XML translator.
(For "JSON," substitute your preferred format.)

Problem solved! ;-)

--
eso...@comcast-dot-net.invalid
Five hundred forty days to go.

Arne Vajhøj

unread,
Jul 30, 2019, 8:04:22 PM7/30/19
to
On 7/30/2019 1:28 AM, Cecil Westerhof wrote:
> Arne Vajhøj <ar...@vajhoej.dk> writes:
>
>> On 7/29/2019 2:59 PM, Cecil Westerhof wrote:
>>> When I start jshell it remembers the history from previous runs. Where
>>> is this saved?
>>
>> I believe it uses preferences API.
>>
>> So it is OS specific.
>>
>> Windows => registry
>>
>> *nix => $HOME/.java dir
>
> I already thought about that, but in ~/.java I saw only a fonts
> directory. Looking better there is also an .userPrefs directory.
> (First time I see a hidden directory in a hidden directory.) The file
> I need is:
> ~/.java/.userPrefs/tool/JShell/prefs.xml
>
> I do not like that it is XML, but it is what it is.

-Djava.util.prefs.userRoot=.

should move the file to current dir.

And:

-Djava.util.prefs.PreferencesFactory=something

should allow you to use your entirely own preferences repo.

Arne



0 new messages