Search code examples
javajakarta-eeclasspathjava-web-startjava.library.path

Difference between classpath & java.library.path ? How to set it in linux & windows?


Here is my problem - I get error pop up like - "no XXX in java.library.path" // Note: XXX is some .dll of API

Actually I am running .jnlp file; which starts java web start. Software installation instruction says install jre 32 bit in order to run. I use linux mint which is 64 bit & already have jre 64 which i use for other purpose.


Solution

  • If installation instructions say to install a 32-bit JRE to run the program, then that's what you'll have to do. A 32-bit native library won't work with a 64-bit process (which a 64-bit JRE creates). 32-bit and 64-bit JRE can live side by side on the same computer - this should not be a problem.

    Don't worry about the library path, Java web start will take care of it for you.

    You do need to specify the native libraries with <nativelib> tags, instead of regular <jar> tags in the JNLP file. Example for the LWJGL library:

      <resources>
        <jar href="lwjgl.jar"/>
        <jar href="lwjgl_util.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>
    

    In your case I suppose you only have 32-bit native libs, and perhaps not for many operating systems.