Make jar run in 32bit jre

How can I indicate that to run the specific Java application that I created, you need to install a 32-bit JRE on your system? Further, how can I indicate that a Java application should use a 32-bit JRE, not a 64-bit JRE, if installed?

Background:

I created an application that uses a third-party 32-bit library. Application cannot work in 64-bit JRE.

I am going to distribute this application to many computers in my company, so I need to be able to specify the required JRE in the code or during the export process.

I use eclipse, Kepler to develop and create a java application.

+4
source share
3 answers

java , , .., .

, , , / . , , ( Oracle JDK Win7 64)

  • java.vm.name: Java- HotSpot (TM) 64- .
  • sun.arch.data.model: 64
  • sun.cpu.isalist: amd64

,

String vmname = System.getProperty("java.vm.name");
+2

Java, JVM. dos script, JAVA_HOME %JAVA_HOME%\bin PATH. , sethome.bat,

@echo off
set "JAVA_HOME=c:\Program Files (x86)\Java\jre6"
set "PATH=%JAVA_HOME%\bin;%PATH%"

call "%SERVICE_HOME%\sethome"
"%JAVA_HOME%\bin\java" -version
echo If this does not look correct press CTRL-C to cancel otherwise
pause
0

You cannot be sure at all that the program launches your jar. I can transfer it to a bank acroreador zipsomething else, and you can do nothing about it.

So, I just try to load the library and do the correct error / exception handling. Who knows? Maybe your client, meanwhile, replaced this library with a 64-bit version, not knowing about it? So this is: loading, and if it does not interrupt with an elegant eror message, this is the only reasonable thing.

0
source

Source: https://habr.com/ru/post/1529108/


All Articles