I wanted to use the yandex api translate It works in Java project but not in Codename One project
I followed these steps to add an api in a project like i did in java project: https://github.com/rmtheis/yandex-translator-java-api
i want to translate what is in the label when i click on a button i modified the key with mykey for confidential information
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
Translate.setKey("mykey");
try {
setTranslatedText(Translate.execute("bonjour", Language.FRENCH, Language.ENGLISH));
} catch (Exception e) {
e.printStackTrace();
}
ldesc2.setText("Description (Anglais):"+getTranslatedText());
}
});
When i clicked i have an Error:Exception: java.lang.NoClassDefFoundError - org/json/simple/JSONValue
I experienced a similar thing when trying to add an external library (I was trying to use javax.mail). I had a separate program that worked perfectly but when implemented into my codename one project I got the same java.lang.NoClassDefFoundError
error. The issue is codename one does not work with external libraries, only codename one extensions. If you go into preferences and look at the extensions tab, you can search for a library that does a similar thing.