benchpresser
benchpresser

Reputation: 2188

Java jnlp force to run with 32bits version

Our java client application needs java of 32bits because of used dlls. There is no option for 64bits jvm. But our clients, 300+ users, need 64bits jvm installed on their computers because another application needs 64bits jvm on their operationg systems (windows). As a result they have to install both 32 and 64 bits jvm. When clicking our jnlp, it runs automatically with 64 bits jvm and our program fails. Is there any option/syntax in the jnlp file to force a specific jvm? I do not mean the libraries or nativelibs, i mean when clicking our jnlp file, the 32bits jvm should start.

It is not possible/feasible to edit environment path variables on 300 clients, we need a global solution, just by editing our jnlp file. Is that possible?

Upvotes: 4

Views: 1289

Answers (1)

mth
mth

Reputation: 677

You can force javaws to use the 32-bit JRE by specifying an invalid j2se version for 64-bit (1.0.0 in the sample below, note that j2se version needs to be specified inside the arch-specific resources section for it to work).

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="file:///c:/jnlp" href="demo.jnlp">
    <information>
        <title>Demo</title>  
    </information>
    <security>
        <all-permissions/>
    </security> 
    <resources>
        <jar href="demo.jar" />
    </resources>
    <resources os="Windows" arch="amd64">
        <j2se version="1.0.0"/>
    </resources>    
    <resources os="Windows" arch="x86">
        <j2se version="1.8+"/>
        <jar href="win32/swt.jar"/>
    </resources>
    <application-desc main-class="package.to.MainClass"/>
</jnlp>

Note that this is a bit of a "dirty hack" and may well stop working with a future release.

Upvotes: 2

Related Questions