Have Java program running on Windows and Raspberry Pi. When running the program on Pi, I need to use -Djava.library.path=/usr/lib/jni
when I run the jar so the
RXTX libs can be found
. I want to do it in code withSystem.setProperty()
, but it doesn't work.
Any known issues with setProperty()
on Pi?
Verified so files on Pi are in /usr/lib/jni
. Print out shows path is being sent to setProperty()
as expected.
if (doPi == true)
s = "/usr/lib/jni"; // Pi so files
else
s = "C:\\Program Files (x86)\\Java\\jre1.8.0_181\\bin"; // Win dll files
System.setProperty("java.library.path", s);
System.out.println("Java lib path " + s);
I expected the setProperty()
code would allow me to not need
-Djava.library.path=/usr/lib/jni
When running the jar file.
But without it, I get an error that the
RXTX lib files are not found
.