Error thrown while loading gnu.io.RXTXCommDriver












0















I am trying to run a java program which list all available ports using Eclipse IDE in Ubuntu 14.04. My program is as follows:



import gnu.io.CommPortIdentifier;

import java.util.Enumeration;


public class ListAvailablePorts {

public void list() {
Enumeration ports = CommPortIdentifier.getPortIdentifiers();

while(ports.hasMoreElements())
System.out.println(((CommPortIdentifier)ports.nextElement()).getName());
}
public static void main(String args) {
new ListAvailablePorts().list();

}

}


But it shows the following warning followed by error:



Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library     /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
at ListAvailablePorts.list(ListAvailablePorts.java:11)
at ListAvailablePorts.main(ListAvailablePorts.java:17)









share|improve this question














bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    I am trying to run a java program which list all available ports using Eclipse IDE in Ubuntu 14.04. My program is as follows:



    import gnu.io.CommPortIdentifier;

    import java.util.Enumeration;


    public class ListAvailablePorts {

    public void list() {
    Enumeration ports = CommPortIdentifier.getPortIdentifiers();

    while(ports.hasMoreElements())
    System.out.println(((CommPortIdentifier)ports.nextElement()).getName());
    }
    public static void main(String args) {
    new ListAvailablePorts().list();

    }

    }


    But it shows the following warning followed by error:



    Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library     /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so which might have disabled stack guard. The VM will try to fix the stack guard now.
    It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
    java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) thrown while loading gnu.io.RXTXCommDriver
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1119)
    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
    at ListAvailablePorts.list(ListAvailablePorts.java:11)
    at ListAvailablePorts.main(ListAvailablePorts.java:17)









    share|improve this question














    bumped to the homepage by Community 1 hour ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0


      2






      I am trying to run a java program which list all available ports using Eclipse IDE in Ubuntu 14.04. My program is as follows:



      import gnu.io.CommPortIdentifier;

      import java.util.Enumeration;


      public class ListAvailablePorts {

      public void list() {
      Enumeration ports = CommPortIdentifier.getPortIdentifiers();

      while(ports.hasMoreElements())
      System.out.println(((CommPortIdentifier)ports.nextElement()).getName());
      }
      public static void main(String args) {
      new ListAvailablePorts().list();

      }

      }


      But it shows the following warning followed by error:



      Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library     /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so which might have disabled stack guard. The VM will try to fix the stack guard now.
      It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
      java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) thrown while loading gnu.io.RXTXCommDriver
      Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
      at java.lang.ClassLoader$NativeLibrary.load(Native Method)
      at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
      at java.lang.Runtime.loadLibrary0(Runtime.java:870)
      at java.lang.System.loadLibrary(System.java:1119)
      at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
      at ListAvailablePorts.list(ListAvailablePorts.java:11)
      at ListAvailablePorts.main(ListAvailablePorts.java:17)









      share|improve this question














      I am trying to run a java program which list all available ports using Eclipse IDE in Ubuntu 14.04. My program is as follows:



      import gnu.io.CommPortIdentifier;

      import java.util.Enumeration;


      public class ListAvailablePorts {

      public void list() {
      Enumeration ports = CommPortIdentifier.getPortIdentifiers();

      while(ports.hasMoreElements())
      System.out.println(((CommPortIdentifier)ports.nextElement()).getName());
      }
      public static void main(String args) {
      new ListAvailablePorts().list();

      }

      }


      But it shows the following warning followed by error:



      Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library     /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so which might have disabled stack guard. The VM will try to fix the stack guard now.
      It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
      java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) thrown while loading gnu.io.RXTXCommDriver
      Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
      at java.lang.ClassLoader$NativeLibrary.load(Native Method)
      at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
      at java.lang.Runtime.loadLibrary0(Runtime.java:870)
      at java.lang.System.loadLibrary(System.java:1119)
      at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
      at ListAvailablePorts.list(ListAvailablePorts.java:11)
      at ListAvailablePorts.main(ListAvailablePorts.java:17)






      14.04 java eclipse serial-port






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 26 '15 at 8:00









      Dhaval SimariaDhaval Simaria

      6492824




      6492824





      bumped to the homepage by Community 1 hour ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 1 hour ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Hi I had this problem as well



          I use ubantu 12.4 on an old machine what i found was that library used was incorrect You can download the correct libraries for this from You need o also change your Java to oracle Java and follow the instructions for setting this up on ubantu make sure you do this first



          After which update-alternatives java and select Oracle java for jvm



          Instructions below on link here I would recommend you do this by hand it teaches you how to install this manually which to be fair is by far the better method



          https://stackoverflow.com/questions/25729592/how-to-install-jdk-8-in-ubuntu-12-04-using-tar-gz-file



          Preferably follow these instructions



          How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?



          You also need to make yourself a member of uucp and dial-out otherwise you wont be able to open the serial port



          See instructions for doing this below



          How to add existing user to an existing group?



          After this you need RXTX from the net this can be downloaded from
          http://rxtx.qbang.org/wiki/index.php/Download



          You want rxtx 2.1-7r2 (stable) release for linux



          open the zip file and follow the instructions



          When it comes to installing the library use the file inside the "i686-unknown-linux-gnu" Folder and copy into your jdk / jvm folder as instructed whilst logged in as root (sudo -i) for root access



          Next you will possibly want an ide



          My suggestion is Netbeans again just follow instructions for installation on linux



          After you have done ALL OF THE ABOVE "QUITE A PROCESS SO TAKE YOUR TIME "



          Past code into Netbeans having created a project This worked for me !!



          See Sample Java Code at this link here to gain better understanding



          http://playground.arduino.cc/Interfacing/Java



          I use this to communicate with my Arduino dev board which I prefer to write my own interfaces for



          You will also need to add the relevant jar file to your project see picture below



          To do this you will need to right click the library and tell the ide where to find the rxtxcomm jar file so that you can add this to your project



          I had enormous success with this PS Ive only been using Ubantu now for 4 weeks and already I'm sold on this os its that good






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f590118%2ferror-thrown-while-loading-gnu-io-rxtxcommdriver%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Hi I had this problem as well



            I use ubantu 12.4 on an old machine what i found was that library used was incorrect You can download the correct libraries for this from You need o also change your Java to oracle Java and follow the instructions for setting this up on ubantu make sure you do this first



            After which update-alternatives java and select Oracle java for jvm



            Instructions below on link here I would recommend you do this by hand it teaches you how to install this manually which to be fair is by far the better method



            https://stackoverflow.com/questions/25729592/how-to-install-jdk-8-in-ubuntu-12-04-using-tar-gz-file



            Preferably follow these instructions



            How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?



            You also need to make yourself a member of uucp and dial-out otherwise you wont be able to open the serial port



            See instructions for doing this below



            How to add existing user to an existing group?



            After this you need RXTX from the net this can be downloaded from
            http://rxtx.qbang.org/wiki/index.php/Download



            You want rxtx 2.1-7r2 (stable) release for linux



            open the zip file and follow the instructions



            When it comes to installing the library use the file inside the "i686-unknown-linux-gnu" Folder and copy into your jdk / jvm folder as instructed whilst logged in as root (sudo -i) for root access



            Next you will possibly want an ide



            My suggestion is Netbeans again just follow instructions for installation on linux



            After you have done ALL OF THE ABOVE "QUITE A PROCESS SO TAKE YOUR TIME "



            Past code into Netbeans having created a project This worked for me !!



            See Sample Java Code at this link here to gain better understanding



            http://playground.arduino.cc/Interfacing/Java



            I use this to communicate with my Arduino dev board which I prefer to write my own interfaces for



            You will also need to add the relevant jar file to your project see picture below



            To do this you will need to right click the library and tell the ide where to find the rxtxcomm jar file so that you can add this to your project



            I had enormous success with this PS Ive only been using Ubantu now for 4 weeks and already I'm sold on this os its that good






            share|improve this answer






























              0














              Hi I had this problem as well



              I use ubantu 12.4 on an old machine what i found was that library used was incorrect You can download the correct libraries for this from You need o also change your Java to oracle Java and follow the instructions for setting this up on ubantu make sure you do this first



              After which update-alternatives java and select Oracle java for jvm



              Instructions below on link here I would recommend you do this by hand it teaches you how to install this manually which to be fair is by far the better method



              https://stackoverflow.com/questions/25729592/how-to-install-jdk-8-in-ubuntu-12-04-using-tar-gz-file



              Preferably follow these instructions



              How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?



              You also need to make yourself a member of uucp and dial-out otherwise you wont be able to open the serial port



              See instructions for doing this below



              How to add existing user to an existing group?



              After this you need RXTX from the net this can be downloaded from
              http://rxtx.qbang.org/wiki/index.php/Download



              You want rxtx 2.1-7r2 (stable) release for linux



              open the zip file and follow the instructions



              When it comes to installing the library use the file inside the "i686-unknown-linux-gnu" Folder and copy into your jdk / jvm folder as instructed whilst logged in as root (sudo -i) for root access



              Next you will possibly want an ide



              My suggestion is Netbeans again just follow instructions for installation on linux



              After you have done ALL OF THE ABOVE "QUITE A PROCESS SO TAKE YOUR TIME "



              Past code into Netbeans having created a project This worked for me !!



              See Sample Java Code at this link here to gain better understanding



              http://playground.arduino.cc/Interfacing/Java



              I use this to communicate with my Arduino dev board which I prefer to write my own interfaces for



              You will also need to add the relevant jar file to your project see picture below



              To do this you will need to right click the library and tell the ide where to find the rxtxcomm jar file so that you can add this to your project



              I had enormous success with this PS Ive only been using Ubantu now for 4 weeks and already I'm sold on this os its that good






              share|improve this answer




























                0












                0








                0







                Hi I had this problem as well



                I use ubantu 12.4 on an old machine what i found was that library used was incorrect You can download the correct libraries for this from You need o also change your Java to oracle Java and follow the instructions for setting this up on ubantu make sure you do this first



                After which update-alternatives java and select Oracle java for jvm



                Instructions below on link here I would recommend you do this by hand it teaches you how to install this manually which to be fair is by far the better method



                https://stackoverflow.com/questions/25729592/how-to-install-jdk-8-in-ubuntu-12-04-using-tar-gz-file



                Preferably follow these instructions



                How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?



                You also need to make yourself a member of uucp and dial-out otherwise you wont be able to open the serial port



                See instructions for doing this below



                How to add existing user to an existing group?



                After this you need RXTX from the net this can be downloaded from
                http://rxtx.qbang.org/wiki/index.php/Download



                You want rxtx 2.1-7r2 (stable) release for linux



                open the zip file and follow the instructions



                When it comes to installing the library use the file inside the "i686-unknown-linux-gnu" Folder and copy into your jdk / jvm folder as instructed whilst logged in as root (sudo -i) for root access



                Next you will possibly want an ide



                My suggestion is Netbeans again just follow instructions for installation on linux



                After you have done ALL OF THE ABOVE "QUITE A PROCESS SO TAKE YOUR TIME "



                Past code into Netbeans having created a project This worked for me !!



                See Sample Java Code at this link here to gain better understanding



                http://playground.arduino.cc/Interfacing/Java



                I use this to communicate with my Arduino dev board which I prefer to write my own interfaces for



                You will also need to add the relevant jar file to your project see picture below



                To do this you will need to right click the library and tell the ide where to find the rxtxcomm jar file so that you can add this to your project



                I had enormous success with this PS Ive only been using Ubantu now for 4 weeks and already I'm sold on this os its that good






                share|improve this answer















                Hi I had this problem as well



                I use ubantu 12.4 on an old machine what i found was that library used was incorrect You can download the correct libraries for this from You need o also change your Java to oracle Java and follow the instructions for setting this up on ubantu make sure you do this first



                After which update-alternatives java and select Oracle java for jvm



                Instructions below on link here I would recommend you do this by hand it teaches you how to install this manually which to be fair is by far the better method



                https://stackoverflow.com/questions/25729592/how-to-install-jdk-8-in-ubuntu-12-04-using-tar-gz-file



                Preferably follow these instructions



                How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?



                You also need to make yourself a member of uucp and dial-out otherwise you wont be able to open the serial port



                See instructions for doing this below



                How to add existing user to an existing group?



                After this you need RXTX from the net this can be downloaded from
                http://rxtx.qbang.org/wiki/index.php/Download



                You want rxtx 2.1-7r2 (stable) release for linux



                open the zip file and follow the instructions



                When it comes to installing the library use the file inside the "i686-unknown-linux-gnu" Folder and copy into your jdk / jvm folder as instructed whilst logged in as root (sudo -i) for root access



                Next you will possibly want an ide



                My suggestion is Netbeans again just follow instructions for installation on linux



                After you have done ALL OF THE ABOVE "QUITE A PROCESS SO TAKE YOUR TIME "



                Past code into Netbeans having created a project This worked for me !!



                See Sample Java Code at this link here to gain better understanding



                http://playground.arduino.cc/Interfacing/Java



                I use this to communicate with my Arduino dev board which I prefer to write my own interfaces for



                You will also need to add the relevant jar file to your project see picture below



                To do this you will need to right click the library and tell the ide where to find the rxtxcomm jar file so that you can add this to your project



                I had enormous success with this PS Ive only been using Ubantu now for 4 weeks and already I'm sold on this os its that good







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 23 '17 at 12:39









                Community

                1




                1










                answered Sep 17 '15 at 20:47









                MarkMark

                112




                112






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f590118%2ferror-thrown-while-loading-gnu-io-rxtxcommdriver%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How did Captain America manage to do this?

                    迪纳利

                    南乌拉尔铁路局