Is there any way in java by using which we can uninstall an application. I am developing an application by using which i need to check if application is installed or not. If it is installed then first i have to uninstall the application and install the newer version of it.
If it is not installed then directly go for installing. Code what i have written is:
String v = "C:\\Program Files\\InstalledFile";
File file = new File(v);
if(file.exists()==true)
{
System.out.print("file exist");
FileUtils.deleteDirectory(file);
System.out.print("deleted");
Runtime run = Runtime.getRuntime();
String msifile = "EP.msi";
String para="rundll32 SHELL32.DLL,ShellExec_RunDLL msiexec /qb /i C:\\Setup\\EP.msi REBOOT=ReallySuppress";
run.exec(para);
}
else
System.out.print("file won't exist");
In this code i am deleting the folder for uninstalling but that is not the solution as application still exist.