How to distinguish 32 bit from 64 bit java version in jnlp files
Asked Answered
R

1

12

To start our legacy application, we use java WebStart via a jnlp.

We would like to support 64-bit Java clients but one of our libraries is architecture dependent.

We thought of doing something like:

<resources>
  <j2se version="1.6+" sun.arch.data.model="64"/>
  <jar href="/apps/swt-3.7M5-win32-win32-x86_64_s.jar" download="eager" />
</resources>
<resources>
  <j2se version="1.6+" />
  <jar href="/apps/swt-3.7M5-win32-win32-x86_s.jar" download="eager" />
</resources>

This is not working because the parameter sun.arch.data.model="64" is used to set the parameter instead of testing on it.

Any ideas?

Rapt answered 1/2, 2013 at 10:13 Comment(1)
Glad you got it sorted. :)Scape
D
11

This is explained in the documentation, here: http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#resources

It doesn't say which arch values make sense, though. You would want it to work for different JVM implementations and versions. I googled around for a while and here's what I've ended up using:

  <resources>
    <java version="1.6+"/>
    <jar href="lwjgl-2.8.4.jar"/>
    <jar href="lwjgl_util-2.8.4.jar"/>
  </resources>

  <!-- LWJGL Linux 64-bit native libraries -->
  <resources os="Linux" arch="amd64">
    <nativelib href="lwjgl-amd64-linux.jar"/>
  </resources>
  <resources os="Linux" arch="x86_64">
    <nativelib href="lwjgl-amd64-linux.jar"/>
  </resources>

  <!-- LWJGL Linux 32-bit native libraries -->
  <resources os="Linux" arch="x86">
    <nativelib href="lwjgl-x86-linux.jar"/>
  </resources>
  <resources os="Linux" arch="i386">
    <nativelib href="lwjgl-x86-linux.jar"/>
  </resources>

  <!-- LWJGL Windows 64-bit native libraries -->
  <resources os="Windows" arch="amd64">
    <nativelib href="lwjgl-amd64-win.jar"/>
  </resources>
  <resources os="Windows" arch="x86_64">
    <nativelib href="lwjgl-amd64-win.jar"/>
  </resources>

  <!-- LWJGL Windows 32-bit native libraries -->
  <resources os="Windows" arch="x86">
    <nativelib href="lwjgl-x86-win.jar"/>
  </resources>
  <resources os="Windows" arch="i386">
    <nativelib href="lwjgl-x86-win.jar"/>
  </resources>

  <!-- LWJGL MAC OS/X native libraries -->
  <resources os="Mac">
    <nativelib href="lwjgl-macosx.jar"/>
  </resources>
Dolan answered 2/2, 2013 at 11:22 Comment(1)
Thanks for pointing me in the right direction. The working solution became: <resources arch="amd64"> <jar href="/apps/swt-3.7M5-win32-win32-x86_64_s.jar" download="eager" /> </resources> <resources arch="x86"> <jar href="/apps/swt-3.7M5-win32-win32-x86_s.jar" download="eager" /> </resources>Rapt

© 2022 - 2024 — McMap. All rights reserved.