I put rxtxcomm.jar into jre/lib/ext folder, but I still get NoClassDefFoundError Isn’t this folder automatically taken into the global classpath?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
yes it is taken automatically to classpath, but RXTXcomm uses JNI /native external libraries (.so and .dll files), you must provide the path to them when running your program in command line:
for linux:
suppose you unpacked the rxtx.zip to
/home/user/
if you have 32bit x86 platofrm:
if you have 64bit x86 platform the it would be:
for windows:
suppose you downloaded and unpacked it to C:\rxtxt
If you find it cumbersome to do it from command line you can do it from yout code (before opening port via RXTXcomm):
EDIT:
of course, you must put RXTXcomm.jar in your classpath in addition to all of the above. If running from command line as jar packaged program – yourprogram.jar – inside the jar you must have a META-INF folder that contains MANIFEST.MF with the following entries:
and yourprogram.jar must be in folder which has folder lib in which is RXTXcomm.jar, also
the class with
method must be called Main and reside in package named pkg (just replace pkg.Main with whatever you have).
Then you can run your program succesfully and open a serial port if you have one. This approach also eliminates the need to copy anything in jre/lib/ext folder
EDIT^2:
or, if you don’t want to pack your program in jar, position yourself in folder which contains the folder pkg and write:
(all paths can be relative or absolute)
EDIT^3:
but I would recommend Java Simple Serial Connector instead of RXTXcomm: