A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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.
rocket mass heater
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