File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to execute commands or sh files from JAVA in Solaris Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to execute commands or sh files from JAVA in Solaris" Watch "How to execute commands or sh files from JAVA in Solaris" New topic
Author

How to execute commands or sh files from JAVA in Solaris

Sundeep Mohanty
Greenhorn

Joined: Jan 28, 2003
Posts: 7
Hi,
I am trying to execute some commands and shell script from java program in Solaris OS, I tried in the follwoing manner, but its not working.
Pls help me.
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec("/bin/sh -c /app/xchanging/xasRND/Testing.sh");
or
Process p = runtime.exec("/app/xchanging/xasRND/Testing.sh");

Regards,
Sundeep.
Ulas Ergin
Ranch Hand

Joined: Oct 10, 2002
Posts: 77
I use Runtime.exec("sh myscript") but you need to exhaust out and error streams
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
is a great resource.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to execute commands or sh files from JAVA in Solaris