1

I'm developing a Java ME project in Intellij. When I try to call a function from the javax.microedition package, all functions simply return null. After inspection, these functions exist but contain no substance (are unimplemented). For example, the javax.microedition.io.connector class function .open(String var) appears this way and always returns null:

public static Connection open(String var0) throws IOException { return null; }

This function does not match the documentation provided by Oracle and according to the documentation Connector is not an abstract class. All other functions I inspected seem to be implemented the same way. Did I miss a step in setting up the Java ME SDK? Am I missing something?

Additionally this is the code I try to run but returns null:

 ServerSocketConnection server = (ServerSocketConnection) Connector.open("socket://:4040");

1 Answer 1

3

These are called stub classes. They only contain method signatures and default return values. You can use them to compile your code without problems.

When you run your app on an emulator (or on an actual device) these classes will have a proper implementation and behave as expected.

1
  • Thank you for the response! I will try my project using an emulator/device!
    – C. Ebert
    Jun 9, 2017 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.