Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What exactly am I not doing right?

Status
Not open for further replies.

GarrettSF

Programmer
Jul 22, 2008
11
0
0
US
I have been working on a GUI that does an assortment of tasks. The final and last task is to make copies of a 3dModel conversion program and a script file that is required to make the converter run and convert. The converter and the script file are moved to a user specified directory. The user specified directory contains all of the models that will be converted. The problem is, I can't get the GUI to boot the converter with the script file. To make the converter work, you need to pass two window's cmd commands but the commands need to occur from the same directory as the converter and script file. This is what I have tried to do:
Code:
String[] commands = new String[]{"cmd ",
"/c ",
"cd ",
smdDirectory.getPath(),
"skmodel ",
"model_definition.txt "};
try{				
Process child = Runtime.getRuntime().exec(commands);}
catch(IOException e){}

The files have all ready copied to the correct directory. All I need is for the GUI to execute the "skmodel model_definition.txt" commands in the correct directory. What am I doing wrong?
 
Can you show us the dos command directly(without any unknown variable or string)?
The dos command I used in my program is
dir>aa
Code:
public class TestDos
{
public static void main(String args[]){
String[] commands = new String[]{"cmd.exe ",
"/C",
"dir>aa",
};
try{                
Process child = Runtime.getRuntime().exec(commands);}
catch(Exception e){e.printStackTrace();}
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top