installing j2sdk-1_3_1-solsparc.sh using .exec()?

i have a custom InstallShield wizard panel that checks to see if the JDK is on the client mahcine - if not it will attempt to install:

if (os.startsWith("Windows"))

executeCmd(workingDir + fileSep + "3rdParty" + fileSep + "java" + fileSep

+ "j2sdk1_3_0-win.exe");

else if (os.startsWith("SunOS"))

executeCmd(workingDir + fileSep + "3rdParty" + fileSep + "java" + fileSep

+ "j2sdk-1_3_1-solsparc.sh");

}

private void executeCmd(String strCommand)

{

try {

System.out.println("executing: " + strCommand);

Process p = Runtime.getRuntime().exec(strCommand);

p.waitFor();

}

}

works fine under windows, but on solaris it hangs!

i believe that what it's doing is launching the JDK install and then waiting for some user response - the only problem is that i can't SEE the JDK installation - that is, it's not opening up a new window for the process...

is there any way, through Java, that i can automically launch the j2sdk-1_3_1-solsparc.sh installation?

thanks,

shyam***

[1122 byte] By [scoberoi] at [2007-9-26 1:52:07]
# 1

have you run the jdk shell script from a Unix command line? maybe there is no windowed process, maybe its only command-line, I forget...

You can programmatically control a process started through Runtime.exec() by getting the Process (returned by exec) and then manipulating the process through its input stream and output stream:

Process p = Runtime.getRuntime().exec(/*your command, env, etc*/);

BufferedReader in = new BufferedReader(new InputStreamReader(p.getOutputStream())); // process' output stream is an input stream for me

BufferedWriter out = new BufferedWriter(new OutputStreamWriter(p.getInputStream())); // process' input stream is an output stream for me

out.write( /* send some text to the process */);

out.newLine();

out.flush();

schillj at 2007-6-29 3:01:25 > top of Java-index,Archived Forums,Java Programming...