File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
Java in General
How to execute a command from Java in Linux?
Joined: May 17, 2004
Jun 15, 2007 23:40:00
I am trying to execute a command from
in linux, like this:
cmd = ..... ;
Process x = Runtime.getRuntime().exec( cmd );
But my problem is I need to setup some shell variables for my Linux command?
How can I do that?
And I am running this Runtime.getRuntime().exec() in my own
Thank you for any tips.
Joined: Mar 22, 2005
Jun 16, 2007 01:10:00
You can run the command inside of a short shell script, which would set up the shell variables, and then call the actual command.
I agree. Here's the link:
subject: How to execute a command from Java in Linux?
Running a .bat/ .cmd file from Java
Runtime getRuntime() exec(String command) - How does this work?
Mysql database restore through java application...?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015