1 2 Previous Next 16 Replies Latest reply: Nov 6, 2010 2:36 AM by 584107 RSS

    java comm api in 64-bit Linux

    843829
      I apologise if this is off-topic. I can't find a suitable forum, I tried posting in the Java plugin forum, but no luck there. I would appreciate any ideas to find a solution.

      I am trying to use the java comm api to read and write to the serial port but I am getting the following error:

      Error loading LinuxSerialParallel: java.lang.UnsatisfiedLinkError: /usr/lib64/libLinuxSerialParallel.so: Can't load IA 32-bit .so on a AMD 64-bit platform

      I am using openSUSE 10.2 (X86-64) which uses Linux 2.6.18.2-34-default x86_64.

      I tried Switching to a 32-bit version of java (1.4.2) from within Eclipse and I always run Eclipse in 32-bit java (/usr/share/eclipse/eclipse -vm /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java) but I still get this error.

      Is there anything I can do to get the java comm api working on a 64-bit system?

      Is the java comm api still being developed and maintained? It does not look like it is?

      I've done some searching on the web and I find there is an open source version of the java comm api called RXTX but the website at http://www.rxtx.org/ is not very readable. I don't think I know enough to install this on my system.

      I would appreciate any ideas to get this working.

      Thanks,

      Martin
        • 1. Re: java comm api in 64-bit Linux
          843829
          I apologise if this is off-topic. I can't find a
          suitable forum, I tried posting in the Java plugin
          forum, but no luck there. I would appreciate any
          ideas to find a solution.

          I am trying to use the java comm api to read and
          write to the serial port but I am getting the
          following error:

          Error loading LinuxSerialParallel:
          java.lang.UnsatisfiedLinkError:
          /usr/lib64/libLinuxSerialParallel.so: Can't load IA
          32-bit .so on a AMD 64-bit platform

          I am using openSUSE 10.2 (X86-64) which uses Linux
          2.6.18.2-34-default x86_64.

          I tried Switching to a 32-bit version of java (1.4.2)
          from within Eclipse and I always run Eclipse in
          32-bit java (/usr/share/eclipse/eclipse -vm
          /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java) but
          I still get this error.

          Is there anything I can do to get the java comm api
          working on a 64-bit system?

          Is the java comm api still being developed and
          maintained? It does not look like it is?

          I've done some searching on the web and I find there
          is an open source version of the java comm api called
          RXTX but the website at http://www.rxtx.org/ is not
          very readable. I don't think I know enough to install
          this on my system.
          RXTX is the way to go.

          Click on the HOWTO link at the top of the page and follow the directions.
          • 2. Re: java comm api in 64-bit Linux
            843829
            Thanks very much for your reply. The Howto page is certainly a lot more readable then their home page! I followed the instructions (although some filenames etc. didn't correspond the names of the actual files on the website) but I think I did it right. However I'm still getting a similar error message:

            java.lang.UnsatisfiedLinkError: /usr/lib64/libSerial.so: Can't load IA 32-bit .so on a AMD 64-bit platform

            Does this mean I need to get the source code from their website and compile it myself as 64-bit? I don't think I have the expertise to do that.

            Do you know of any ready compiled 64-bit rxtx binaries?

            Thanks,

            Martin
            • 3. Re: java comm api in 64-bit Linux
              843829
              >
              Does this mean I need to get the source code from
              their website and compile it myself as 64-bit? I
              don't think I have the expertise to do that.
              You won't know if you don't try. I was going to give it a try on my windows x64 machine, but the RXTX server seems to be having DNS problems so I can't download the source.

              If you've downloaded the source, have a look at the README file. Usually, compiling is as simple as typing
              ./configure
              which will check your system for all necessary libraries and set reasonable compiler/linker options for your machine.

              If it spits out an error, Google the error message. Odds are good that someone else compiling something had the same error and figured out what library was missing.

              Once it configures cleanly, you type
              make
              or
              make install
              Read the README and INSTALL files to be sure.

              >
              Do you know of any ready compiled 64-bit rxtx
              binaries?
              They don't seem to be floating around anywhere.


              Jim S.
              • 4. Re: java comm api in 64-bit Linux
                843829
                Jim,

                Thanks again, I've been trying to find the source code for about 3 days now without any success. Most of the links on http://www.rxtx.org/ seem to be broken including the wiki and various links to the source code, I get the impression that the site is no longer maintained?

                I've also tried Sourceforge and elsewhere without any success.

                Although this software is lgpl there seems to be some danger of it being lost. Any ideas?

                I know that serial and parallel ports are considered 'legacy' these days. In desperation I considered finding a java-usb api and then using a usb-serial adapter, but even attempts to bulid a java-usb api seem to have been abandoned around 2003.

                Is Java not considered a suitable language for communicating with physical ports?

                Martin
                • 5. Re: java comm api in 64-bit Linux
                  843829
                  Hi,

                  I checked out the sources from the CVS with no problem.
                  See how to at http://users.frii.com/jarvi/rxtx/cvs.html

                  Verify also your firewall.

                  --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                               
                  • 6. Re: java comm api in 64-bit Linux
                    843829
                    Thanks, I managed to load the code from CVS but configure and make are crashing out.

                    I think the problem is that, in addition to building the binaries it is trying to build the jar and it wants to use the java here:
                    /usr/lib64/jvm/java
                    But I actually have java installed here:
                    /usr/lib64/jvm/java-1.5.0-sun-1.5.0_update10/

                    so it is crashing out as follows:

                    martin@suse102:~/rxtx-devel> ./configure
                    <snip>
                    Exception in thread "main" Exception while printStackTrace(): java.lang.NoClassDefFoundError: java/lang/System
                    /usr/lib64/jvm/java
                    configure: WARNING: using JAVA_HOME environmental variable
                    adjusted java.home is /usr/lib64/jvm/java
                    checking os.name Exception in thread "main" Exception while printStackTrace(): java.lang.NoClassDefFoundError: java/lang/System
                    <snip>
                    martin@suse102:~/rxtx-devel> make install
                    make: *** No rule to make target `install'. Stop.

                    for full trace see:
                    http://www.euclideanspace.com/software/language/java/comm/hardware/rxtxConfig.txt

                    Martin
                    • 7. Re: java comm api in 64-bit Linux
                      843829
                      Thanks, I managed to load the code from CVS but
                      configure and make are crashing out.

                      I think the problem is that, in addition to building
                      the binaries it is trying to build the jar and it
                      wants to use the java here:
                      /usr/lib64/jvm/java
                      But I actually have java installed here:
                      /usr/lib64/jvm/java-1.5.0-sun-1.5.0_update10/

                      so it is crashing out as follows:

                      martin@suse102:~/rxtx-devel> ./configure
                      <snip>
                      Exception in thread "main" Exception while
                      printStackTrace(): java.lang.NoClassDefFoundError:
                      java/lang/System
                      /usr/lib64/jvm/java
                      configure: WARNING: using JAVA_HOME environmental
                      variable
                      adjusted java.home is /usr/lib64/jvm/java
                      checking os.name Exception in thread "main"
                      Exception while printStackTrace():
                      java.lang.NoClassDefFoundError: java/lang/System
                      <snip>
                      martin@suse102:~/rxtx-devel> make install
                      make: *** No rule to make target `install'. Stop.

                      for full trace see:
                      http://www.euclideanspace.com/software/language/java/c
                      omm/hardware/rxtxConfig.txt

                      Martin
                      Before running configure, type the following:
                      export JAVA_HOME=/usr/lib64/jvm/java-1.5.0-sun-1.5.0_update10
                      I had similar errors on my x86 Linux box.
                      • 8. Re: java comm api in 64-bit Linux
                        843829
                        Its still not working, it feels so close but I'm just being beaten by the complexities of running java on linux.

                        I tried:
                        export JAVA_HOME=/usr/lib64/jvm/java-1.5.0-sun-1.5.0_update10
                        but it only contains a jre directory and the configure script seems to require the bin, include and lib directories.

                        I guess that as I have been using Eclipse that it does not require the full jvm? I am using the standard install that comes with SUSE10.2 inside /usr/lib64/jvm/ there are 18 directories that seem to be various combinations of java-sun, java-caco and java-gcj combined with 1.4.2 or 1.5.0, some are jre and some are full jdk. Also some of these directories are just pointers which point to /etc/alternatives/java_sdk which then have subdirectories which point to other directories. All of this makes it very hard to see what is going on, I can't find a jdk which I am sure is sun and 64-bit.

                        Do you think I should install java 1.6 and start again with that? I don't want to do anything which might stop Eclipse and Open Office working.

                        Martin

                        PS if you have working 64-bit binaries I would welcome them at mjb4567@yahoo.com
                        • 9. Re: java comm api in 64-bit Linux
                          843829
                          Its still not working, it feels so close but I'm just
                          being beaten by the complexities of running java on
                          linux.

                          I tried:
                          export
                          JAVA_HOME=/usr/lib64/jvm/java-1.5.0-sun-1.5.0_update10

                          but it only contains a jre directory and the
                          configure script seems to require the bin, include
                          and lib directories.
                          Yes. the configure script is looking for a JDK. It needs the Java compiler and the jar tool.

                          >
                          I guess that as I have been using Eclipse that it
                          does not require the full jvm?
                          Eclipse has a full JVM, but it has its own development tools (compiler, debugger, etc) so it does not need a JDK.
                          I am using the
                          standard install that comes with SUSE10.2 inside
                          /usr/lib64/jvm/ there are 18 directories that seem to
                          be various combinations of java-sun, java-caco and
                          java-gcj combined with 1.4.2 or 1.5.0, some are jre
                          and some are full jdk. Also some of these directories
                          are just pointers which point to
                          /etc/alternatives/java_sdk which then have
                          subdirectories which point to other directories. All
                          of this makes it very hard to see what is going on, I
                          can't find a jdk which I am sure is sun and 64-bit.
                          What does the output of
                          javac -version
                          report?

                          If it says command not found or something like that then you probably don't have a JDK installed or the binaries aren't in your PATH.
                          >
                          Do you think I should install java 1.6 and start
                          again with that? I don't want to do anything which
                          might stop Eclipse and Open Office working.
                          Installing a JDK should not affect Ecplise or OpenOffice. Since Suse is RPM based, you should be able to download the RPM from here:

                          http://java.sun.com/javase/downloads/index.jsp

                          Martin

                          PS if you have working 64-bit binaries I would
                          welcome them at mjb4567@yahoo.com
                          The only 64-bit machine I have access to is Windows only. Sorry.
                          • 10. Re: java comm api in 64-bit Linux
                            843829
                            Yes, looks like I have the IBM version of the jdk rather than the Sun version

                            martin@suse102:~> javac -version
                            Exception in thread "main" Exception while printStackTrace(): java.lang.NoClassDefFoundError: java/lang/System

                            martin@suse102:~> /usr/lib64/jvm/java-1.4.2-gcj-1.4.2.0/bin/javac -version
                            Eclipse Java Compiler 0.670, 3.2.0 release, Copyright IBM Corp 2000, 2006. All rights reserved.
                            martin@suse102:~>

                            So I pointed JAVA_HOME to this version and ran ./configure
                            This ran to completion alright but produced the following warning:

                            WARNING: configure is having a hard time determining which
                            directory contains the file jni_md.h. Edit Makefile and fix the
                            variable JAVANATINC to point to the correct directory.

                            The only copy of jni_md.h that I could find was in
                            /usr/lib64/jvm/java-1.4.2-cacao-0.96/include/jni_md.h

                            I tried pointing JAVA_HOME to that and running config but there were come exceptions.

                            So it looks like I need to install the Sun JDK, this may take me some time.

                            Thanks for your help so far,

                            Martin
                            • 11. Re: java comm api in 64-bit Linux
                              843829
                              I'm stuck again so I would appreciate some more help. I've managed to install the Sun 1.6 JDK and configure and make rxtx.

                              But it still does not work, I get the following error when I run the SerialDemo:

                              java.lang.UnsatisfiedLinkError: com.sun.comm.Unix.isDevLink(Ljava/lang/String;)Z
                                   at com.sun.comm.Unix.isDevLink(Native Method)
                                   at com.sun.comm.PathBundle.add(PathBundle.java:108)
                                   at com.sun.comm.PlatformPortBundle.<init>(PlatformPortBundle.java:44)
                                   at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:138)
                                   at SerialDemo$ConfigurationPanel.listPortChoices(SerialDemo.java:612)
                                   at SerialDemo$ConfigurationPanel.<init>(SerialDemo.java:488)
                                   at SerialDemo.<init>(SerialDemo.java:134)
                                   at SerialDemo.main(SerialDemo.java:81)

                              It seems to be com.sun.comm which is not finding its native binary not rxtx! This is what confuses me, the instructions say install the Solaris version of comm api (http://www.rxtx.org/ how-to said Solaris Sparc and the rxtx INSTALL file said Solaris x86 so I tried both in turn and neither worked) normally these would call the Solaris binary drivers but I assume this has to be redirected to rxtx which calls its own binaries?

                              I assume the line "Driver=gnu.io.RXTXCommDriver" in /javax.comm.properties somehow redirects these calls but without the source of the comm api its hard to know what is going on.

                              Another thing that confuses me, the http://www.rxtx.org/ how-to said add 'jcl.jar' to your CLASSPATH, should that be 'RXTXcomm.jar'? I can't work out what else it should be.

                              Thanks for reading this far, help much appreciated.

                              Martin
                              • 12. Re: java comm api in 64-bit Linux
                                843829
                                I'm stuck again so I would appreciate some more help.
                                I've managed to install the Sun 1.6 JDK and configure
                                and make rxtx.
                                Any small amount of progress is still progress. :)

                                >
                                But it still does not work, I get the following error
                                when I run the SerialDemo:
                                <snip>

                                >
                                It seems to be com.sun.comm which is not finding its
                                native binary not rxtx!
                                No, it's finding the shared library, unless there are a few more lines at the start of your error message that look like this:
                                Error loading LinuxSerialParallel: java.lang.UnsatisfiedLinkError: 
                                no LinuxSerialParallel in java.library.path
                                It's not finding the function it is looking for in that library.
                                This is what confuses me, the
                                instructions say install the Solaris version of comm
                                api (http://www.rxtx.org/ how-to said Solaris Sparc
                                and the rxtx INSTALL file said Solaris x86 so I tried
                                both in turn and neither worked)
                                Same here after downloading the latest stuff to my x86 Linux box. I received a similar UnsatisfiedLinkError. I checked the shared libraries and the functions were not in it.
                                normally these would
                                call the Solaris binary drivers but I assume this has
                                to be redirected to rxtx which calls its own
                                binaries?
                                Yes. There is a part of RXTX called JCL (Java Comm for Linux) that handles that.

                                http://www.geeksville.com/~kevinh/linuxcomm.html

                                However, I think the problem is that Sun's API has changed since the RXTX How-To was written. Try downloading the 'comm.jar' at the bottom of the page. It says:
                                 comm.jar, 2.0.3, generic, English (3rd party backward compatibility, only), English
                                Unzip it and copy the comm.jar file to the 'jre/lib/ext' folder of the JDK/JVM where everything else RXTX created was placed.

                                After doing this the SerialDemo app started for me without errors.

                                Jim S.
                                • 13. Re: java comm api in 64-bit Linux
                                  843829
                                  Jim,

                                  It works!

                                  Thanks very much, I could not have got it working on my own.

                                  I should have guessed that it would be the generic version of the comm.jar but it was the last of the 4 I tried!

                                  In case it is useful to anyone else I have put the 64-bit versions of rxtx binaries here:
                                  http://www.euclideanspace.com/software/language/java/comm/
                                  I havn't put any instructions there, I don't want to overlap with the other howtos.

                                  I would be nice to encourage Sun to support this interface better. I guess its not realistic to ask them to support 'legacy' interfaces? I would be good if they were to open source the code. It would be even better a USB version of the interface were actively developed. What is the best way for end users to lobby Sun to do these things?

                                  Thanks again,

                                  Martin
                                  • 14. Re: java comm api in 64-bit Linux
                                    843829
                                    Jim,

                                    It works!
                                    Good.
                                    I would be nice to encourage Sun to support this
                                    interface better. I guess its not realistic to ask
                                    them to support 'legacy' interfaces? I would be good
                                    if they were to open source the code. It would be
                                    even better a USB version of the interface were
                                    actively developed. What is the best way for end
                                    users to lobby Sun to do these things?
                                    There is an existing Request For Enhancement:

                                    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519117

                                    It only has 6 votes though, so it's pretty low on the list.

                                    Jim S.
                                    1 2 Previous Next