This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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


Win a copy of Building Microservices this week in the Design forum!
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to execute commands or sh files from JAVA in Solaris
 
It's not a secret anymore!