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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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
how to execute shell(unix) through a servlet.
executing bash script doesn't work
executing java commands using a java program
I want to login ( using Telnet ) to a Unix server