ATCommand class not found when running on EHS6 | Telit Cinterion IoT Developer Community
July 4, 2020 - 7:58am, 2152 views
I'm working with a ESH6 module, I created the attached test program, it compiles fine but it crashes when trying to run it on the EHS6 module with the following error:
Test()
startApp()
destroyApp()
java.lang.NoClassDefFoundError: com/cinterion/io/ATCommand
- Test.startApp(Test.java:17)
- javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
- com.sun.midp.midlet.MIDletPeer.startApp(), bci=5
- com.sun.midp.midlet.MIDletStateHandler$StartAppTimerTask.run(), bci=12
- java.util.TimerThread.mainLoop(), bci=244
- java.util.TimerThread.run(), bci=1
MIDlet:Test abnormal exit
MIDlet:Test abnormal exit
import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException; import com.cinterion.io.ATCommand; public class Test extends MIDlet { public Test() { System.out.println("Test()"); } protected void startApp() throws MIDletStateChangeException { System.out.println("startApp()"); ATCommand atcmd; try { atcmd = new ATCommand(false); String res = atcmd.send("AT+GSN\r"); System.out.println("res: " + res); } catch (Exception e) { e.printStackTrace(); } finally { destroyApp(true); } } protected void pauseApp() { System.out.println("pauseApp()"); } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { System.out.println("destroyApp()"); notifyDestroyed(); } }
I solved it:
I found a similar thread where they solved it by adding a cwmlib_1.0.jar inside the CMTK/EHS5/WTK/resources installation folder, however, my installation does not contain that folder nor the cwmlib_1.0.jar file, I installed from this version: ehsx_rev04.003_arn0100004_install-cd.zip I also downloaded the ehsx_rev03.001_arn0000051_install-cd.zip file and inside this one I could find the resources/cwmlib_1.0.jar, copied it to my installation and referenced it in my application, it works now :)
Regarding this, what would be the reason for ehsx_rev04.003 no not include the cwmlib_1.0.jar? Could it have been integrated into other CMTK libs?
What is the most recent version of the CMTK or the recommended one to work with EHS6?
Also, are there any Linux compatible tools?
Hello,
The best approach is to use the java libs from the installation package released for the firmware version that you have on the module. There was a change in EHSx relase 4 - cwmlib_1.0.jar is no longer needed as it was integrated in the firmware. In release 3 you have to export this lib with your MIDlet.
Currently the Gemalto SDK installation package is distributed for Windows system only. However it would probably be possible to build MIDlet in Linux with some extra manual configuration or a build script. But for now we don't provide any tools.
Best regards,
Bartłomiej
I only have installed the SDK from ehsx_rev04.003_arn0100004_install-cd.zip, I also downloaded ehsx_rev03.001_arn0000051_install-cd.zip and decompressed it without installing it. But as I mention, I was not able to use the ATCommand class until adding the cwmlib_1.0.jar from this older release.
By using only the SDK from ehsx_rev4.003_arn0100004_install-cd.zip should I be able to use the ATCommand class? Without adding the cwmlib_1.0.jar I was able to build the project but not to run it as it halts when trying to use the ATCommand class with this message:
java.lang.NoClassDefFoundError: com/cinterion/io/ATCommand
Hello,
I have just tried with EHS5-E REVISION 04.003 A-REVISION 01.000.04 - I've built the MIDlet with all libraries taken from the installation CD package for this module. cwmlib_1.0.jar was not added to the project and not exported with the MIDlet. The AT commands did work on the module. It would not work on ehsx_rev03.001 module. For rev3 module cwmlib_1.0.jar is required.
Please check your setup and configuraion and import AtCmdDemo MIDlet if necessary to have a fresh project. I believe it should work.
Regards,
Bartłomiej