Pages

Monday, January 20, 2014

run msi file from java how to

 run msi file from java how to


My requirement is to initiate an MSI - Microsoft Installer file from Java

Solution is at this link:

http://www.coderanch.com/t/518149/java/java/run-msi-file-Java-ProcessBuilder

Some more tutorial is available here,

http://www.rgagnon.com/javadetails/java-0014.html

As usual , We need to use Runtime.getRuntime() method.
I tried this code in  Windows Server 2008 R2.
A sample code is shown below.

try {
       Runtime run = Runtime.getRuntime();
       run.exec("rundll32 SHELL32.DLL,ShellExec_RunDLL msiexec /qb /i C:\\flash_ie.msi REBOOT=ReallySuppress");
}
catch (Exception e) {
    e.printStackTrace();
}
 

How ever this does not worked in Windows Server 2012 Edition.

At last this command worked both in Windows Server 2008 Rs and Windows Server 2012 .


"msiexec  /i  <Full_Path_To_MSI>"

No comments:

Post a Comment