Detecting if a program is already installed with NSIS

How about this. I had this in an old NSIS script laying around. ; Check to see if already installed ReadRegStr $R0 HKLM “SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<YOUR-APP-NAME>” “UninstallString” IfFileExists $R0 +1 NotInstalled messagebox::show MB_DEFBUTTON4|MB_TOPMOST “<YOUR-APP-NAME>” \ “0,103” \ “<YOUR-APP-NAME> is already installed.” \ “Launch Uninstall” “Cancel” Pop $R1 StrCmp $R1 2 Quit +1 Exec $R0 Quit: Quit NotInstalled:

Is it possible to call Ant or NSIS scripts from Java code?

You can call ant scripts from Java code. See this article (scroll down to the “Running Ant via Java” section) and this article: File buildFile = new File(“build.xml”); Project p = new Project(); p.setUserProperty(“ant.file”, buildFile.getAbsolutePath()); p.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); p.addReference(“ant.projectHelper”, helper); helper.parse(p, buildFile); p.executeTarget(p.getDefaultTarget()); Update I tried with the following ant file , it … Read more

How do you request administrator permissions using NSIS?

Outfile RequireAdmin.exe RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on) !include LogicLib.nsh Function .onInit UserInfo::GetAccountType pop $0 ${If} $0 != “admin” ;Require admin rights on NT4+ MessageBox mb_iconstop “Administrator rights required!” SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED Quit ${EndIf} FunctionEnd Page InstFiles Section SectionEnd is the basic code I usually recommend to make sure … Read more

How do I detect which kind of JRE is installed — 32bit vs. 64bit

The JVM architecture in use can be retrieved using the “os.arch” property: System.getProperty(“os.arch”); The “os” part seems to be a bit of a misnomer, or perhaps the original designers did not expect JVMs to be running on architectures they weren’t written for. Return values seem to be inconsistent. The NetBeans Installer team are tackling the … Read more