wood burning stoves 2.0*
The moose likes Java in General and the fly likes Trapping of different shells like DOS,Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Trapping of different shells like DOS,Unix" Watch "Trapping of different shells like DOS,Unix" New topic
Author

Trapping of different shells like DOS,Unix

kulkarni gururaj
Greenhorn

Joined: Mar 26, 2001
Posts: 4
I will be thankful to 'U' if u try to solve follwing :
1.As u can know one can run all the commands of a DOS prompt
e.g like this
try{
Process p=Runtime.getRuntime.exec(Some dos command);
Like this how one can trap other shells like Unix.
(I want mainly for Enhydra shell)
Also i want more details of trapping DOS shell
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Runtime.exec() executes a command according to the local operating system. It is important to note, however that unless you explicitly ask it to, it does not run any sort of shell, jusr executes the command directly. On DOS/Windows, the upshot is largely as if you had typed the command at a DOS prompt, but because there is no DOS shell, some builtin commands will not work. On Unix, the same is generally true; most commands will work OK, but shell builtins require an explicit invocation of a shell (using "/bin/sh -c command", for example).
If you wish to invoke any other shell, you will need to run it and pass any interactive commands to it either on its command line or through the streams you get from Runtime.exec();


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Similarly, to run the commands which would be available from a DOS prompt, you must in many cases invoke cmd.exe first. This is the executable which interprets DOS comands. See this article for much more information and examples - in particular, see the program GoodWindowsExec.java.
[This message has been edited by Jim Yingst (edited March 26, 2001).]


"I'm not back." - Bill Harding, Twister
kulkarni gururaj
Greenhorn

Joined: Mar 26, 2001
Posts: 4
Hi! FrancCarver,
Thanks,What u have told is correct.But the samething i want in more descripted way.Will u help me
...........Gururaj
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Trapping of different shells like DOS,Unix
 
Similar Threads
Setting Java Path in Linux
please help me to learn unix online.
What is a Shell
URGENT !! How can a shell script get the System.exit() exit value?
a linux file browsing program?