M
micro
hi all,
I use java in windows xp and I want to execute .jar files in my java
program i tried the next code but it didn't work.
no errors in compilation,and no exception when I run it ,yet my
des.jar file didn't run.
public class RunIt {
public static void main(String args[]){
String[] commands=new String[3];
commands[0]="cmd.exe";
commands[1]="cd C:\\Documents and Settings\\ASUS\\Desktop";
commands[2]="java -jar des.jar";
try {
Runtime.getRuntime().exec(commands);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
although when I try: "java -jar des.jar" in the command line it works
fine
I use java in windows xp and I want to execute .jar files in my java
program i tried the next code but it didn't work.
no errors in compilation,and no exception when I run it ,yet my
des.jar file didn't run.
public class RunIt {
public static void main(String args[]){
String[] commands=new String[3];
commands[0]="cmd.exe";
commands[1]="cd C:\\Documents and Settings\\ASUS\\Desktop";
commands[2]="java -jar des.jar";
try {
Runtime.getRuntime().exec(commands);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
although when I try: "java -jar des.jar" in the command line it works
fine