Skip to Main Content

jdk.dio with Java SE instead of Java ME

WillemDFeb 23 2015 — edited Feb 24 2015

Sorry to post it in the Java ME community. It is really an SE question with the jdk.dio libraries from ME.

After my unresolved problems with opening /dev/servoblaster pipe from Java ME (see my other post), I switched to Java SE and added the jdk.dio libraries, both in netbeans and on the raspberry Pi.

Opening servoblaster works fine but now a new problem:

I am trying the same code that worked perfectly in Java ME to open a GPIO Pin for input, as show below. Doing this in Java SE with jdk.dio results in a nullpointerexception on the last statement when I try to check whether the Pin is opened. I get the same error when I try to set a value of the Pin. No error message on de statement.

Since this works without problems in the Java ME environment I suspect is has something to do with the setup of the remote device and related permissions.

I SE the setup of the remote device is different and as far as I can see I can't see the permission in the same way as for a Java ME embeddeddevice. In netbeans I defined the Pi as a remote runtime platform and during the build it connects and compiles without problems.

The permissions I have set on the Pi. Since I found the security instructions rather unclear I have added the GPIOPin GPIOPort and DeviceMgmt permissions to several files (better safe than sorry :-) )




but this does not make a difference.

I also defined the additional B+ GPIO pins in /dev/config/

Any idea why this does not work? Any advice appreciated.



code used:

        GPIOPinConfig config2 = new GPIOPinConfig(portID, 12, GPIOPinConfig.DIR_INPUT_ONLY,  DeviceConfig.DEFAULT, GPIOPinConfig.TRIGGER_BOTH_EDGES, false);

        try {
            HCSR04Receive =;
        } catch (IOException ex) {
            Logger.getLogger(hcsr04me.class.getName()).log(Level.SEVERE, null, ex);


This post has been answered by WillemD on Feb 24 2015
Jump to Answer
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Mar 24 2015
Added on Feb 23 2015