PDA

View Full Version : Silent install using ProcessExec



ivanyue
03-16-2003, 12:38 PM
I am trying to create a product action to silent install an ISMP Jar file. However, I have problem passing the installLocation when the location has space in the file name.

When install the project using command line:
d:\j2sdk1.4.1_01\bin\java.exe -cp SimpleTypical\default\disk1\s
etup.jar run -swing -P installLocation="c:\program files\mydir"

Everything is doing well. and the files are installed onto "c:\program files\mydir".

However, when I install the project using ProcessExec api, The file are installed onto "c:\program" instead. I have escaped the quotation mark around the filename, but still does not work.

Do you have any suggestion?

Here is my testcase. I have also attach the complete testcase:

import com.installshield.util.*;

public class ProcessExecTest {


public static void main(String[] argument) {

String javaLocation=argument[0];
String setupJarLocation=argument[1];

//String cmd="D:\\j2sdk1.4.1_01\\bin\\java.exe";
String[] args=new String[6];
args[0] = "-cp";
//args[1] = "E:\\My Source is here\\setup.jar";
args[1] = setupJarLocation;
args[2] = "run";
args[3] = "-swing";
args[4] = "-P";
args[5] = "installLocation=\"c:\\program files\\mydir\"";

System.out.println("Command is:");
System.out.println(
javaLocation+" "+
args[0]+" "+
args[1]+" "+
args[2]+" "+
args[3]+" "+
args[4]+" "+
args[5] );


ProcessExec process=new ProcessExec(javaLocation, args);
try {
process.executeProcess();
} catch (Exception e) {
e.printStackTrace();
}

}

}