Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trapping of different shells like DOS,Unix

 
kulkarni gururaj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
kulkarni gururaj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! FrancCarver,
Thanks,What u have told is correct.But the samething i want in more descripted way.Will u help me
...........Gururaj
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic