aspose file tools*
The moose likes Servlets and the fly likes unix commands thru java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "unix commands thru java program" Watch "unix commands thru java program" New topic
Author

unix commands thru java program

Bhasker Reddy
Ranch Hand

Joined: Jun 13, 2000
Posts: 176
can we issue unix commands thru java program.
I am writing a java file, i have shell program. I need to
issue those directives to the unix system thru java program
can i do that.
does anyone has any idea regarding this.
if i am not clear enough please let me know
thanks


Bhasker Reddy
Kripal Singh
Ranch Hand

Joined: Jul 26, 2001
Posts: 254
you can execute your command using following code
Runtime rt = Runtime.getRuntime();
try{
Process ps = rt.exec(your command here);

}
catch(Exception e)
{
System.out.print(e.getMessage());
}


# Help an unprivileged kid.<br /> Whatever u do will make a difference...<br /> ...to a child's life & ur own #<br /><a href="http://www.cry.org/" target="_blank" rel="nofollow">www.cry.org/</a>
 
Don't get me started about those stupid light bulbs.
 
subject: unix commands thru java program
 
Similar Threads
issuing unix commands thru java program
Issue commands from Java
I wanted to login ( using Telnet ) to a Linux server
can I run telnet thru a java program?
I want to login ( using Telnet ) to a Unix server