Search code examples
javatcpjava-meembeddedraspberry-pi2

TCP Permission JavaME8


I've been developing an application that is going to use a Broker running in an IMLet on a Raspberry Pi. The problem is that whilst the application runs fine as a .jar when I try to run as an IMLet I get the following error during build:

Compiling 1 source file to F:\OneDrive\Documents\NetBeansProjects\Coordinator\build\classes
F:\OneDrive\Documents\NetBeansProjects\Coordinator\src\dangardner\coordinator\Coordinator.java:27: error: cannot access URI
            broker.addConnector("tcp://localhost:61616");
  class file for java.net.URI not found

Here is a small snippet of the code running the Broker: BrokerService broker = new BrokerService();

    try {
        System.out.println("Starting Coordinator");
        broker.addConnector("tcp://localhost:61616");
        broker.start();
        System.out.println("Started");

    } catch (Exception ex) {
        Logger.getLogger(Coordinator.class.getName()).log(Level.SEVERE, null, ex);
    }

I've read the documentation on API permissions and don't fully understand it so I understand if could be a problem with this, so any help here would also be appreciated.


Solution

  • It turns out that Brokers are not supported by Java MicroEdition. Although I was able to create a Broker object without any IDE errors because it was referencing an external jar when it came to compile there were features the jar used not supported by Java ME.

    I hope this helps anyone with a similar error in the future!