I am writing a command-line program in Java (https://gitlab.com/gitlabcyclist/secondmemory), and I'd like to be able to run nano
so the user can edit questions from within the program. I tried using ProcessBuilder
like this:
new ProcessBuilder("nano", "myfile").inheritIO().start();
This doesn't work, though. nano
is displayed, but I can't edit the file.
Just to be clear: I want to open nano
so that a temporary file can be edited by the user. I'm looking for a way to do something like a system call in C or Ruby.
I'm sorry if there's already an answer to this question. Googling it provides no help, as all of the results are about using nano
to edit Java files.
Any help would be appreciated.