3 Replies Latest reply on Dec 13, 2017 12:38 AM by Intel Corporation

    exception in mraa

    kupi

      Dear community members,

       

      I am playing around Intel Edison's GPIO with mraa using Java, and got an exception shown below when I executed the sample code (BlinkIO.java):

       

      Exception in thread "main" java.lang.UnsatisfiedLinkError: mraa.mraaJNI.ERROR_PLATFORM_ALREADY_INITIALISED_get()I

              at mraa.mraaJNI.ERROR_PLATFORM_ALREADY_INITIALISED_get(Native Method)

              at mraa.Result.<clinit>(Result.java:24)

              at mraa.Gpio.dir(Gpio.java:67)

              at BlinkIO.main(BlinkIO.java:58)

       

      I searched this exception name, but I got no further information about the details of the exception description

      "Exception in thread "main" java.lang.UnsatisfiedLinkError: mraa.mraaJNI.ERROR_PLATFORM_ALREADY_INITIALISED_get()I".

       

      Could anybody tell me what this exception means?

       

      Best regards,

        • 1. Re: exception in mraa
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello Ryosuke,

          Thank you for your interest in our Intel products.

          Have you tried any other sample code? Do you still get the exception on other sample code?
          Also please try this code below and let me know if it works:

          import mraa.Gpio;  public class EdisonTest {      static {         try {             System.loadLibrary("mraajava");         } catch (UnsatisfiedLinkError e) {             System.err.println("Native code library failed to load.");             System.exit(1);         }     }      public static void main(String[] args) throws InterruptedException {         Gpio gpio = new Gpio(11);         gpio.dir(Dir.DIR_OUT);         int state = 1;          while (true){             gpio.write(state);             state = (state==1?0:1);              Thread.sleep(1000);         }     }   }   Regards, Octavian
          • 2. Re: exception in mraa
            kupi

            Hello Octavian,

             

            Thank you very much for your reply. I am very grateful for your help.

            I tried to execute some other samples and the code you suggested, but I still get the same exception:

             

            Exception in thread "main" java.lang.UnsatisfiedLinkError: mraa.mraaJNI.ERROR_PLATFORM_ALREADY_INITIALISED_get()I

                    at mraa.mraaJNI.ERROR_PLATFORM_ALREADY_INITIALISED_get(Native Method)

                    at mraa.Result.<clinit>(Result.java:24)

                    at mraa.Gpio.dir(Gpio.java:67)

                    at EdisonTest.main(EdisonTest.java:43)

             

            The exception always occurs at the line where the direction of the pin is set.

            I wonder if the meaning of the exception helps to solve the problem.

             

            Best regards,

            Ryosuke

            • 3. Re: exception in mraa
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hello Ryosuke,

              Please tell me what commands are you running to compile and run the BlinkIO.java example.
              Also what version of mraa  do you have installed and which Edison image are you using?

              Regards,
              Octavian