Parser.java:3: package org.json does not exist

29 views
Skip to first unread message

Bhavdip Bhalodia

unread,
Dec 10, 2020, 3:24:23 AM12/10/20
to j2objc-discuss
Hi Tomball,

Hope you are doing great 👍 

I am using  j2objc since 2017. now I want to upgrade my library and apis calls using j2objc. But I am getting error as below:

/Users/bhavdip/Documents/my-projects/sdk-core/core-ios/../core-android/core/src/main/java/com/COMPANY/libs/core/SCBaseApiRequest.java:3: package org.json does not exist


Same error getting in all other classed where I am using org.json.*. And I unable to discover this issue/fix. 

So please let me tell how to fix this issue with j2objc-2.7.


Thanks & Regards

Bhavdip

Anuja Nikam

unread,
Dec 10, 2020, 7:13:02 AM12/10/20
to j2objc-discuss
I am also facing the same issue. I have updated j2Objc to release 2.7. package not found compile time error I am getting while executing J2ObjC.

Tom Ball

unread,
Dec 10, 2020, 12:44:02 PM12/10/20
to j2objc-discuss
The Android version of org.json was moved into a separate library, as developers complained they could not use other org.json implementations:

$ ls j2objc-2.7/lib/*json*
j2objc-2.7/lib/json.jar  j2objc-2.7/lib/libjson.a

To use, add json.jar to j2objc's classpath, and "-l json" to the app's Other Link Flags.

--
You received this message because you are subscribed to the Google Groups "j2objc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to j2objc-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/j2objc-discuss/9806f14c-a7c0-43e5-986f-95596fb34414n%40googlegroups.com.

Bhavdip Bhalodia

unread,
Dec 11, 2020, 1:19:55 AM12/11/20
to j2objc-discuss
Thank you Tomball for your quick response. It worked for me.

Does it mean to add library which are separated from `jre_emul` need to add in j2objc's classpath?

Tom Ball

unread,
Dec 11, 2020, 12:18:43 PM12/11/20
to j2objc-discuss
Does it mean to add library which are separated from `jre_emul` need to add in j2objc's classpath?

That's correct. The org.json API is not part of the Java Runtime, and so developers shouldn't expect it to be on the bootclasspath. We made a mistake by doing so in previous releases, and so removing it in 2.7 is a bug fix.

Reply all
Reply to author
Forward
0 new messages