This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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
 
Similar Threads
Controlling Windows Services from a Java App
executing bash script doesn't work
executing java commands using a java program
I want to login ( using Telnet ) to a Unix server
how to execute shell(unix) through a servlet.