Running 32 and 64 bit java applications on the same windows host

  1. First install both the 32 and 64 bit JREs. Use the default installation locations (i.e. 32 bit Java in the Program Files (x86) directory and 64bit Java in the Program Files directory).
  2. Set the two JAVA_HOME environmental variables: A “JAVA_HOME” variable which points to C:\Program Files\Java\ and a “JAVA_HOME_32” environmental variable which points to C:\Program Files (x86)\Java\.
  3. Start up all 32 bit java applications using the command:  “%JAVA_HOME_32%”\bin\java.exe -cp …
  4. Make sure you’ve either deliberately specified any needed drivers/dlls using the library.path java command line option  (e.g. -Djava.library.path=../lib) or you’ve placed the dependencies in your system path such that there can be no ambiguity about which dll/jar your application will be using.   This can be a big issue when you have identically named dependencies in your system32 and sysWOW64 directories.  Normally,  windows configures it’s path look-up such that it looks in system32 directory first, if running a 64 bit application, and sysWOW64 first, if running a 32 bit application.  I believe this priority can be manually configured in some instances.

There are certainly other ways of accomplishing this same functionality, and I’m curious what others are doing.  Also, the above configuration allowed me to run two population health java applications simultaneously.  Of note: This configuration did not allow me to run a 64 and 32 bit installation of tomcat simultaneously on the same machine (just one at a time).

This entry was posted in 64 bit, Apache, Java, Windows and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *