How to run an API created for a 32-bit version on a 64-bit machine?

I am writing a java application to communicate with, it must communicate with XBee radio on top of usb-cable. For this, I use the xbee-java API ( http://code.google.com/p/xbee-api/ )

On my old 32-bit machine, everything worked fine. But when I imported the project to a 64-bit machine, it immediately throws an exception that says: "Unable to load IA 32-bit.dll IA on a 64-bit AMD platform." I do not know how I can solve this problem.

error code:

java.lang.UnsatisfiedLinkError: C:\Users\Tom\Documents\XbeeJava\rxtxSerial.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform thrown while loading gnu.io.RXTXCommDriver Closing connection with local XBee Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: C:\Users\Tom\Documents\XbeeJava\rxtxSerial.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83) at com.rapplogic.xbee.RxTxSerialComm.openSerialPort(RxTxSerialComm.java:71) at com.rapplogic.xbee.RxTxSerialComm.openSerialPort(RxTxSerialComm.java:61) at com.rapplogic.xbee.api.XBee.open(XBee.java:140) at me.server.HardwareCommunications.SensorListener.run(SensorListener.java:47) at java.lang.Thread.run(Unknown Source) 

Thanks Tom

+6
source share
5 answers

Cannot load a 32-bit DLL into a 64-bit process.

Based on the description of the JVM you are using is 64-bit, but the rxtxSerial.dll DLL is 32-bit. To solve, follow these steps:

  • Get 64-bit rxtxSerial.dll or
  • Install and use the 32-bit JVM with the current rxtxSerial.dll
+7
source

The 64-bit executable (and process) (your Java virtual machine) can only use 64-bit DLLs.

But you could download, install and run the 32-bit version of Java. If you also do not need to access 64-bit DLL files or if you need more than 2 and 3 gigabytes of memory, the 32-bit Java virtual machine will work fine on a 64-bit machine.

+6
source

You can get 64-bit dlls for rxtx here: http://www.cloudhopper.com/opensource/rxtx/

+5
source

It seems that your XBee library relies on JNI to call some inline code in the DLL.

you cannot associate this DLL with a 64-bit Java virtual machine, and that’s fine.

So, you will have: - recompile XBee, if you have access to the source code. - get 64-bit distribution API

Use Java 32Bit VM to execute code.

+1
source

Check out https://github.com/NeuronRobotics/nrjavaserial

It includes several built-in libraries inside the jar (windows, linux, mac, 32 and 64) and loads them automatically, so you forget to tell the JVM where to look for them

+1
source

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


All Articles