Hi,

I want to use a single bitrock installer to install on both 32-bit and 64-bit windows platforms. It works fine, but when I launch the java executable, the java process is listed as 32-bit (java.exe *32 in the task manager). How do I have it launched and run as a 64-bit java process.

The installer script snippet is :

...
 <postInstallationActionList>
        <createJavaLaunchers>
            <destination>${installdir}</destination>
            <javaLauncherList>
                <javaLauncher>
                    <allowCommandLineArguments>1</allowCommandLineArguments>
                    <arguments></arguments>
                    <binaryName>testApp</binaryName>
                    <classpath></classpath>
                    <jarFile>${installdir}/test.jar</jarFile>
                    <mainClass></mainClass>
                    <preferredJavaBinary></preferredJavaBinary>
                    <requestedExecutionLevel>highestAvailable</requestedExecutionLevel>
                    <runInConsole>0</runInConsole>
                    <vmParameters> -Xms1024m -Xmx1024m -XX:MaxNewSize=512m -XX:NewSize=512m  -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:TargetSurvivorRatio=90 -verbose:gc -Xincgc  </vmParameters>
                    <windowsResourceComments> java launcher</windowsResourceComments>
                    <windowsResourceCompanyName>Test</windowsResourceCompanyName>
                    <windowsResourceFileVersion>1.0.0.0</windowsResourceFileVersion>
                    <windowsResourceProductName>TestApp</windowsResourceProductName>
                    <windowsResourceProductVersion>1.0</windowsResourceProductVersion>
                    <workingDirectory>${installdir}</workingDirectory>
                </javaLauncher>
            </javaLauncherList>
        </createJavaLaunchers>
    </postInstallationActionList>
    <enableRollback>1</enableRollback>
    <enableTimestamp>1</enableTimestamp>
    <projectSchemaVersion>1.0</projectSchemaVersion>
    <saveRelativePaths>1</saveRelativePaths>
    <vendor>test</vendor>
    <windows64bitMode>1</windows64bitMode>
    <parameterList>
    ...

asked 07 Dec '12, 23:07

Dracu's gravatar image

Dracu
18811
accept rate: 0%


The installer is probably using a 32 bit java binary to create the launcher. You could either customize the <preferredJavaBinary> or make it use the autodetected 64bit java binary:

   <createJavaLaunchers>
        <destination>${installdir}</destination>
        <javaLauncherList>
             <javaLauncher>
                 ...
                <validVersionList>
                   <validVersion>
                       <bitness>64</bitness>
                    </validVersion>
                 </validVersionList>
                 ...
            </javaLauncher>
        </javaLauncherList>
        <ruleList>
           <platformTest type="windows-x64"/>
        </ruleList>
    </createJavaLaunchers>
link

answered 08 Dec '12, 05:06

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

I have just doublechecked and on 64bit Windows 8 the following worked properly:

<createJavaLaunchers> <destination>${installdir}</destination> <javaLauncherList> <javaLauncher> <allowCommandLineArguments>1</allowCommandLineArguments> <arguments></arguments> <binaryName>testApp</binaryName> <classpath></classpath> <jarFile>test.jar</jarFile> <mainClass></mainClass> <preferredJavaBinary></preferredJavaBinary> <requestedExecutionLevel>highestAvailable</requestedExecutionLevel> <runInConsole>0</runInConsole> <vmParameters> -Xms1024m -Xmx1024m -XX:MaxNewSize=512m -XX:NewSize=512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:TargetSurvivorRatio=90 -verbose:gc -Xincgc </vmParameters> <windowsResourceComments> java launcher</windowsResourceComments> <windowsResourceCompanyName>Test</windowsResourceCompanyName> <windowsResourceFileVersion>1.0.0.0</windowsResourceFileVersion> <windowsResourceProductName>TestApp</windowsResourceProductName> <windowsResourceProductVersion>1.0</windowsResourceProductVersion> <workingDirectory>${installdir}</workingDirectory> <validVersionList> <validVersion> <bitness>64</bitness> <maxVersion></maxVersion> <minVersion></minVersion> <requireJDK>0</requireJDK> <vendor></vendor> </validVersion> </validVersionList> </javaLauncher> </javaLauncherList> </createJavaLaunchers>

That is - it did find 64-bit Java on the system and ran the application as 64-bit process.

Can you doublecheck that you have 64-bit Java installed? Also, can you doublecheck if it is also causing problems using latest version of InstallBuilder?

A lot of users may not have 64-bit Java, so you can also either bundle your own Java binaries or detect if 64-bit Java is present and then enforce the launcher to use - for example:

<setInstallerVariable> <name>preferred_bitness</name> <value>64</value> </setInstallerVariable> <autodetectJava> <abortOnError>0</abortOnError> <promptUser>0</promptUser> <showMessageOnError>0</showMessageOnError> <onErrorActionList> <setInstallerVariable> <name>preferred_bitness</name> <value></value> </setInstallerVariable> </onErrorActionList> <validVersionList> <validVersion> <bitness>64</bitness> <maxVersion></maxVersion> <minVersion></minVersion> <requireJDK>0</requireJDK> <vendor></vendor> </validVersion> </validVersionList> </autodetectJava>

And then specify ${preferred_bitness} for <bitness> in the <javaLauncher>'s valid version list.

This will set preferred_bitness to 64 if 64-bit Java is available or set it to any bitness (empty string) if it is not found.

Information on bundling Java runtime in InstallBuilder binaries can be found in Bundling a JRE section of InstallBuilder User Guide.

link

answered 20 Dec '12, 08:18

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×176
×40
×6
×6

Asked: 07 Dec '12, 23:07

Seen: 2,453 times

Last updated: 20 Dec '12, 08:18