Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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

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

Bhasker Reddy
Kripal Singh
Ranch Hand

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

catch(Exception e)

# Help an unprivileged kid.<br /> Whatever u do will make a difference...<br /> a child's life & ur own #<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: unix commands thru java program
It's not a secret anymore!