I have the following simple code written in java-ME embedded:
public class JavaMEApplication2 extends MIDlet {
@Override
public void startApp() {
GPIOPinConfig config1 = new GPIOPinConfig(DeviceConfig.DEFAULT, 4, GPIOPinConfig.DIR_OUTPUT_ONLY,
DeviceConfig.DEFAULT , GPIOPinConfig.TRIGGER_NONE, true);
try {
GPIOPin pin = (GPIOPin) DeviceManager.open(config1);
Thread.sleep(2000);
pin.setValue(false);
pin.setDirection(GPIOPinConfig.MODE_INPUT_PULL_UP);
} catch (IOException ex) {
Logger.getLogger(JavaMEApplication2.class.getName()).log(Level.SEVERE, null, ex);
} catch (InterruptedException ex) {
Logger.getLogger(JavaMEApplication2.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void destroyApp(boolean unconditional) {
}
}
The previous code run just fine (My LED is turned ON and OFF) until the execution reach this statement:
pin.setDirection(GPIOPinConfig.MODE_INPUT_PULL_UP);
The following exception occurs:
TRACE: <at java.security.AccessControlException: >, startApp threw an Exception java.security.AccessControlException:
My API permissions Configuration:
Can any one please tell me why this exception occurs? and if there's another way to toggle the same pin between OUTPUT Mode and INPUT Mode in java-Me embedded?
I am running into the same problem when i try and use the ADSONG AM2302 temp and humidity sensor, What I have done to avoid that is connect another pin with a pull up resistor to the current pin that is initially input/output and set one pin to output and one to input, it gets rid of the permission problem at least. The sensor is still not responding to my start signal though so this may have cause unforeseen problems
I think it may be failing because you had this parameter in the call to the GPIOPinConfig constructor:
GPIOPinConfig.DIR_OUTPUT_ONLY
Maybe try GPIOPinConfig.DIR_BOTH_INIT_OUTPUT instead.
Look here for the different values and their meanings: https://docs.oracle.com/javame/8.0/api/dio/api/index.html
open your jwc_properties.ini
file from /home/pi/javame8/bin
directory inside raspberry pi and add:
authentication.provider = com.oracle.meep.security.NullAuthenticationProvider
under [internal] section
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.