Other AMX bundles
JasonS
Posts: 229
I am having quite a day today. Anybody used any of the other AMX bundles that are in the Java Build Path by default? I am trying to use the JSON bundle. Duet installs it at start up once it is added to "File Dependencies" in manifest.duetmf:
But I can't use it. If I add it to the "Import Packages" in manifest.duetmf I get a class not found exception at start up, if I don't put it in the "Import Packages" I get the class not found exception when the code that uses JSON runs.
Other than just using the jar directly, does anybody know how to make this work? (JSON isn't really required for this application, I am now using a Property instead. I want to know how to get it to work because I do need it in the future.)
(0000077765) DA: installing dependency: file:doc:/bundle/json-bundle.jar
But I can't use it. If I add it to the "Import Packages" in manifest.duetmf I get a class not found exception at start up, if I don't put it in the "Import Packages" I get the class not found exception when the code that uses JSON runs.
Other than just using the jar directly, does anybody know how to make this work? (JSON isn't really required for this application, I am now using a Property instead. I want to know how to get it to work because I do need it in the future.)
0
Comments
Those bundles are also not documented, so it's better to not depend on them.
When I needed something more, I used generic libraries: this way I had reliable code that can runs on a common JVM.
I like to see AMX as a platform to run code, not as the target platform.
My code can be tested via junit ad has been developed in a TDD way, for example.
Follow the old good software engineering rules: your code should not depend directly on external framework, but encapsulate it in an isolation layer.
My 2 cents
*edit*
This looks like the same issue you faced [post=65963]here[/post].
Yep. The version attribute is optional within the export-package items. If it's not specified it defaults to 0.0.0. This meant that when you tried to import org.json v1.0.0 is was looking for a minimum version of 1.0.0 which it couldn't find and resulted in your resolution issues.