Skip to content
Advertisement

Java Linux Terminal in JPanel

I am making a Scripting Editor and would like to be able to run the Bash/Shell/Python/etc. scripts in the program… So far, I have a way of running them, but there is no way for the scripts to have user input; here’s the code:

JavaScript

Any help/ideas are greatly appreciated!!!

Advertisement

Answer

This is a modification of my previous answer to a question about executing terminal commands from within a JTextArea, but preventing the user from modifying the previously outputted text…

This version adds the ability to send text to the running process

JavaScript

So, I wrote myself a very simple Windows batch file…

JavaScript

It doesn’t do much, it outputs “Hello World!” and prompts the user to enter a value, which is further echoed to the screen and then terminates…

And used it to test the above code…

Terminal

Advertisement