0

I currently create installers for my Java application using NSIS. My application requires native libraries so at the moment I'm creating two installers, one with 32bit and the other with 64bit libs.

The problem is that the type of libraries required is dependent on the JVM, not the OS architecture. Quite understandably users with 64bit Windows will often download the 64bit installer even if they are running a 32bit JVM. Users aren't likely to read (or understand) even if I write an explanation on the download page of my website so a better solution is needed.

Can anyone suggest some nice NSIS script to help detect the JVM type at installation so that the correct libs can be installed. This way I can provide a single Windows installer and hide the complication from the users.

PeteBrew
  • 434
  • 2
  • 14
  • 3
    See http://stackoverflow.com/questions/807263/how-do-i-detect-which-kind-of-jre-is-installed-32bit-vs-64bit/4137875#4137875 I posted the solution I have used successfully there. – Gene Feb 23 '13 at 01:32

1 Answers1

0

If possible, you should consider changing your application to conditionally load the correct native library and create one installer. Your customers will be happier.

Something like (for windows): ( Instructional example only - not production ready )

String archDataModel = System.getProperty("sun.arch.data.model");
String libName   = "Java2WinExample";
String libExt    = ".dll";
String libNameFQ = libName+archDataModel+libExt;
System.loadLibrary(libNameFQ);

Your single installer will install both Java2WinExample32.dll and Java2WinExample64.dll and the application will load the correct library based on invoking JVM.

Java42
  • 7,628
  • 1
  • 32
  • 50