1

I would like to use rxtx library to connect to a serial port. I've already tested a program that identifies available ports and communicate.However, when I export it as a runnable jar file.

I execute it with below command.

java -jar prog.jar

It shows this error and fails (Can't load IA 32-bit .dll on a AMD 64-bit )

What can be wrong ?

Davut Gürbüz
  • 5,526
  • 4
  • 47
  • 83

2 Answers2

0

This provides some details on how to get jvm args used by eclipse...

How can I specify the default JVM arguments for programs I run from eclipse?

In essence check Project Properties -> Run Configurations -> Arguments Tab ->JVM Args (second box below Program Arguments) enter image description here You should copy those arguments and use them in your java <jvmArgs> -jar prog.jar

Check JRE as per below you should use the java from this bin

https://stackoverflow.com/a/4440223/6935152 Project->Properties and choose Java Build Pathand choose the Libraries tab. Find the JRE System Library 

kaza
  • 2,317
  • 1
  • 16
  • 25
  • the box is empty there are no vmArgument – محمود محمود Sep 12 '17 at 21:28
  • Next you should check is Eclipse is using the same java as the one in your shell (where you are running from) – kaza Sep 12 '17 at 21:29
  • how i can check it? – محمود محمود Sep 12 '17 at 21:39
  • when i change the jre in eclipse the pogramme showed me the same probleme(can't load AMD 64-bit .dll on a IA 32-bit platform) – محمود محمود Sep 12 '17 at 21:57
  • 1
    thank you sir ..i put the txrx dll file in C:\Program Files\Java\jdk1.8.0_73\jre\bin and the jar file worked – محمود محمود Sep 12 '17 at 22:51
  • Ah, I expected you to do the other way round. As in use the original jre from Eclipse to run your program. That way we are not altering the way jre works. Putting this dll might effect another program that is using that console java adversely. – kaza Sep 13 '17 at 00:00
  • how i can use the jre that eclipse use in the console? – محمود محمود Sep 13 '17 at 17:02
  • All you've to do is use the full path for java picked up from Eclipse where your test was running. Now there must be two choices of the jre in your Eclipse 1. Original 2. The version you copied the dll for. So you can choose 1 and see where the java bin path is. – kaza Sep 13 '17 at 17:06
  • The proper way to do it set the environment variable JAVA_HOME to bin path picked from original Eclipse and run java as you usually run it. But first test with full path to java then you can do this. – kaza Sep 13 '17 at 17:08
  • But I'll leave it to your choice. As the current setup is working for you, I would continue with the work. – kaza Sep 13 '17 at 17:09
0

Right answer is %99.9 percent you have 64 bit JRE but running with 32bit rxtx. Just install x86 runtime if possible. Problem will be solved.

Aslo consider putting rxtxSerial.dll into syswow64 folder not system32. Normally no need if they're in your classpath working directory.

"The “WOW64” part of the name here refers to Microsoft’s “Windows 32-bit on Windows 64-bit” software, which is a part of the operating system. This allows Windows to run 32-bit programs on a 64-bit version of Windows. WoW64 redirects file access to ensure programs will work properly."

https://www.howtogeek.com/326509/whats-the-difference-between-the-system32-and-syswow64-folders-in-windows/

You can also consider following these steps. http://rxtx.qbang.org/wiki/index.php/Installation_for_Windows

Davut Gürbüz
  • 5,526
  • 4
  • 47
  • 83