Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to run #5

Closed
danielo515 opened this issue Sep 25, 2019 · 9 comments
Closed

Error trying to run #5

danielo515 opened this issue Sep 25, 2019 · 9 comments

Comments

@danielo515
Copy link

Hello, this is awesome, many thanks.
Maybe you can help me with a small problem I'm having while trying to run the compiled program on the simulator. When I use eclipse to run it it runs just fine, but when I try to run the command myself I get the following error:

➜  $SDK_HOME/bin/monkeydo bin/garmin-hello-world.prg fenix5_sim
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:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 5 more

Do you have any idea? Many thanks.

@danielsiwiec
Copy link
Owner

Hi @danielo515. Thank you for submitting the issue. Yes, I have seen this problem with Java 9+, but never got to address it. I just pushed a fix.

Also - which JDK version are you running? The fix will work with Java 9, 10 and 11, but 12 will struggle as JDK stopped shipping with the EE libraries beginning with version 12. I assume the Eclipse plugin will not work with Java 12 either.

I gave this fix a test, but could you also give it a try and let me know, so I can close the issue?

@danielo515
Copy link
Author

Hello @danielsiwiec,
Thank you for your answer.
I'm using the same exact configuration that the eclipse plugin is using. In fact, I just took a look at the eclipse console and just copied the path, so I assume that eclipse is using java 12.
Could you please point me to the fix you are mentioning?

@danielo515
Copy link
Author

Ok, found it:30665fe

@danielo515
Copy link
Author

Where are you taking the file "--add-modules=java.xml.bind" from?

@danielo515
Copy link
Author

Ok, I finally make it work by changing monkeydo script to this

/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/bin/java -classpath "$MB_HOME"/monkeybrains.jar com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux -f "$PRG_PATH" -d $DEVICE_ID -s "$MB_HOME"/shell $TEST_FLAG $TEST_NAME

To be honest, it should not use java directly and should use some of the available options on the path, like JAVA_HOME.
Thanks for your help and support with this

@danielo515
Copy link
Author

In any case, I'm still guessing why this works with eclipse ide, who seems to be using the same java version that I was using. Maybe eclipse plugin includes the required libraries? I hate eclipse, and I have no idea how to check this, but I would love to know it to make my projects a little bit more future proof

@danielo515
Copy link
Author

Finally I get it working by using the following build script without changing the monkeydo or any other script inside the SDK at all:

SDK_HOME=/Users/danielo/garmin-sdk/connectiq-sdk-mac-3.1.4-2019-09-17-f1e7e9687
DEVICE=fenix5
appName=garmin-hello-world
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home

# Build
"$SDK_HOME/bin/monkeyc" \
    --output "$(pwd)/bin/$appName.prg" \
    --private-key /Users/danielo/garmin-sdk/developer_key \
    --device $DEVICE \
    -s 3.0.0 \
    --warn \
    --jungles $(pwd)/monkey.jungle

PATH=$JAVA_HOME/bin:$PATH $SDK_HOME/bin/monkeydo bin/${appName}.prg $DEVICE

@danielsiwiec
Copy link
Owner

danielsiwiec commented Sep 27, 2019

Hmm. I see what you did there. By setting JAVA_HOME like this, you are actually using Java 8 (jdk1.8.0_221.jdk), instead of Java 12.

Regarding --add-modules=java.xml.bind this addresses the problem for Java 10 and 11. They both ship with this file, it's just not included in the classpath by default anymore. Java 12 stopped shipping with it, so this will need a different solution, likely Garmin SDK shipping with this additional JAR.

Thank you for putting the effort into this issue @danielo515!

@danielo515
Copy link
Author

Thanks to you @danielsiwiec !! And thank you for this template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants