Can I use OpenJDK?

Former Member
Former Member

Please forgive me if this is a totally dumb question, I am not a Java developer and am very new to the ConnectIQ SDK.

At this point I am able to build one of the sample apps in the ConnectIQ SDK but I get an error when I try to run it in the simulator. Note that I am running from SublimeText3 but I do see the simulator window starting up and I am able to compile the app so I don't think my choice of IDE is my problem (I hope).

I have tried both JDK and JRE of the OpenJDK General Availability release version 8 (8u222-b10) from https://adoptopenjdk.net/upstream.html 

Here is the error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
    at com.garmin.connectiq.common.prgreader.entrypoints.EntryPoint.parse(EntryPoint.java:88)
    at com.garmin.connectiq.common.prgreader.entrypoints.EntryPoints.parse(EntryPoints.java:51)
    at com.garmin.connectiq.common.prgreader.PrgParser.parse(PrgParser.java:221)
    at com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux.execute(MonkeyDoDeux.java:241)
    at com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux.main(MonkeyDoDeux.java:145)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

(there is a similar error reported in a question about running on Java 11 the error pasted in that question has a slightly different stack trace)

Thanks

  • is there a particular reason why you want to use openjdk?

  • Former Member
    0 Former Member over 5 years ago in reply to peterdedecker

    Well I will be the first to admit that I do not understand Oracle's new licensing model. I was under the impression that if you want to use Oracle Java now and expect any kind of support, you have to pay a subscription.

    I don't particularly wish to pay so I picked AdoptOpenJDK's distribution.

    Either way, I thought that OpenJDK and the commercial Oracle JDK were basically the same under different licensing models. However, as I said in my original question, I am not a Java developer so I have little knowledge on this topic.

    If I am wrong about the licensing model then there is no reason to have chosen OpenJDK. However, it would still be good to know if OpenJDK should be usable for developing with ConnectIQ.

    Thanks

  • Why not first try the development environment that is provided and the one that most people use?

  • Former Member
    0 Former Member over 5 years ago in reply to dpawlyk

    As a developer of C# and Python I am already carrying the knowledge of how to drive 2 IDEs around in my poor brain. When I saw that there was a plugin for one of those IDEs (glorified text editor that is SublimeText3), I thought I would give that a try first rather than try to cram another IDE's key bindings and quirks in.

    I can certainly give Eclipse a go. I tried it some years ago (although I forget why) and did not get along with it but maybe it has improved since then.

    Given my attempt to compile the app was successful and that the simulator started (but crashed with a Java error) I am still optomistic that I can do away with Eclipse.

  • If you are just starting, I'd definitely start with eclipse and the official plugin vs something else and it's plugin.  For one thing the other one may not match the current SDK, and on top of that, probably doesn't have all the functions you'll get in eclipse with CIQ, such as things like the debugger, run no evil, the app settings editor, crash log viewer, manifest editor, etc.

  • Former Member
    0 Former Member over 5 years ago in reply to jim_m_58

    Thanks, I have it installed now. I don't have any time to mess with it today so will have a go tomorrow.

    I did spot a step that I had missed in the install instructions that suggested I put the path to the ConnectIQ SDK on my PATH environment variable. I did this then tested that I could start the simulator from the command line, I also built one of the sample apps and run it in the simulator (all from the command line).

    I then tested in SublimeText again ... and it worked.

    So, I have no idea if installing Eclipse set something else up which I previously missed or if the SDK on the PATH made all the difference. But, I now have my fave IDE working plus Eclipse as a back up if it all goes wrong again.

    Happy days :)

    Oh and I never installed Oracle JDK, so I guess the answer is 'yes - you can use OpenJDK but you may need some voodoo magic to kick start it' Joy