Opening a new UNIX shell with Java

Hello. I am having a problem opening up a UNIX shell in my Java program. I have five internal frames in my program and need to open up a separate UNIX shell in each of them if at all possible. I am still fairly new to Java and I have found no way of doing this. Thanks.
[276 byte] By [lesnaubra] at [2007-11-27 6:28:14]
# 1
stop crossposting!
georgemca at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 2
Runtime.getRuntime().exec("xterm");
Jamwaa at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 3
Use Runtime.getRuntime().exec() for sure, and pay close attention to the Process.get[Input|Output|Error]Stream methods: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html
kevjavaa at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 4

> Use Runtime.getRuntime().exec() for sure, and pay

> close attention to the

> Process.get[Input|Output|Error]Stream methods:

> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Proc

> ess.html

And also note that the terminals won't be opened in any AWT or Swing components.....

georgemca at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 5
Is there any way after i use the xterm command that I can run a command in that shell using Java. For example, is there a way that the new shell brought up by xterm can be stored in my program as a variable and then how can I access it later to give that shell another command? Thanks.
lesnaubra at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 6

> For example, is there a way that the new shell brought up

> by xterm can be stored in my program as a variable

> and then how can I access it later to give that shell

> another command? Thanks.

Instead of running 'xterm' via Runtime.exec(), just run a 'bash'/'cmd' shell. Use the Process.get[Input|Output|Error]Stream methods to pass data and get text returned from the command shell.

kevjavaa at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 7

I'm sorry if I am coming off like an idiot or something but I just cannot figure out how to do this. I use the line:

Runtime.getRuntime().exec("bash");

I know this does something because no errors are given but I just do not know what it does. Is this supposed to open a new shell? Is there anywhere that I can look for code examples on this or could you give me a short one? Thanks.

lesnaubra at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 8

> I'm sorry if I am coming off like an idiot or

> something but I just cannot figure out how to do

> this. I use the line:

>

>Runtime.getRuntime().exec("bash");

> now this does something because no errors are given

> but I just do not know what it does. Is this supposed

> to open a new shell? Is there anywhere that I can

> look for code examples on this or could you give me a

> short one? Thanks.

Are you trying to embed an xterm inside a Swing component?

georgemca at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 9
I would like to do that but I've been told it is not possible. I wouldn't know how to embed it in a Swing component if it is possible.
lesnaubra at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...
# 10
Read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html for futher details
Jamwaa at 2007-7-12 17:51:19 > top of Java-index,Java Essentials,Java Programming...