0
Process proc = new ProcessBuilder("xterm").start();

How can I write and execute commands into this xterm window after the process has been initiated?

In my application I definitely do require executing commands in the same xterm window after it has been initiated.

Ameet Gohil
  • 93
  • 1
  • 6

3 Answers3

0

You might want to try this :

ProcessBuilder pb = new ProcessBuilder("xterm", "myArg1", "myArg2").start();

See ProcessBuilder.

Sandeep Pathak
  • 10,567
  • 8
  • 45
  • 57
0

You cannot explicitly send keystrokes to any external application, but you can send

initialization parameters, for example- Notepad "c:\\index.txt", mycmd.exe -i 10 20 24.

adarshr
  • 61,315
  • 23
  • 138
  • 167
Acn
  • 1,010
  • 2
  • 11
  • 22
0

In Java, you can create a process which can be executed from the Runtime.

xterm is a process such as ls, cat etc...

You are trying to send instruction to an external process using your Java application, you will only be able to init the application using parameters but I guess it is not enough.

You better use directly Java because you will be able to use the Process object which will give you lot of usefull information.

JohnJohnGa
  • 15,446
  • 19
  • 62
  • 87