Question

I am trying to port my lwuit app to codenameone.

I have used a json package in the application. (org.json.me). This package is actually part of json jar and contains classes to manipulate json files.

The application was working fine when I used to make J2ME builds with LWUIT.

In the codename one emulator also, the application is working without any issues.

When I, try to send a J2ME build to the server by right clicking the project and selecting 'Send J2ME Build', my application's build process crashes with some warnings.

Executing: javac -source 1.2 -target 1.2 -classpath C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses;C:\Users\Shai\Desktop\j2me\midpapis.jar -d C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpsrc\GREStub.java Executing: java -jar C:\Users\Shai\Desktop\j2me\proguard.jar -injars . -libraryjars C:\Users\Shai\Desktop\j2me\midpapis.jar -outjars C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\result\GRE.jar -target 1.3 -keep public class ** extends javax.microedition.midlet.MIDlet { public *; } -defaultpackage '' -printmapping C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\result\obfuscation_mapping.txt -overloadaggressively -dontusemixedcaseclassnames -useuniqueclassmembernames -dontoptimize ProGuard, version 4.7
Reading program directory [C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses]
Reading library jar [C:\Users\Shai\Desktop\j2me\midpapis.jar]
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONException
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$9: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$9: can't find referenced class org.json.me.JSONObject
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.siemens.mp.game.Light
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.motorola.phonebook.PhoneBookRecord
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.nokia.mid.ui.FullCanvas
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class net.rim.device.api.system.Application
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.mot.iden.util.Base64
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class mmpp.media.MediaPlayer
Note: there were 6 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
Warning: there were 26 unresolved references to classes or interfaces.
         You may need to specify additional library jars (using '-libraryjars').
Error: Please correct the above warnings first.

Now, i feel that the server is not finding my json package. But i need this build to succeed. I have used the classes of this jar a lot in my app. ANd now i don't want to migrate to the inbuilt json parser as I'll have to change my code a lot which I wish to strictly avoid.

1)What can I do to resolve this?

2)Can we not use third party jars in codename one?

Was it helpful?

Solution

You can't change library classpath in Codename One. Everything must be part of the source directories in order to work properly.

Codename One has its own JSON parser please read about it in the Codename One developer guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top