Facing an issue in Xcode

72 views
Skip to first unread message

Kishore Prabhu Radhakrishnan

unread,
Jan 19, 2021, 11:28:29 PM1/19/21
to j2objc-discuss
Hi Team,

I am using j2objc  for the first time and I am not able to run the source code that I cloned to test from  https://github.com/inoryy/game-of-life-java

I have unzipped the j2objc-2.7 and changed the source path in the  corresponding places as mentioned in the article But I face the error PFA the screenshot

My Xcode version - 12.3
My OS - Catalina - 10.15.7

I am stuck up in this for the past 2 days please provide me a better solution


Regards
Kishore

Screenshot 2021-01-20 at 9.48.28 AM.png

Tom Ball

unread,
Jan 20, 2021, 2:39:51 PM1/20/21
to j2objc-discuss
The error displayed shows the problem: in the J2OBJC_HOME directory (however it's defined in Settings.config) there should be the full distribution (or an equivalent build) of j2objc and its runtime libraries. I recommend that you download the latest release zip file, cd to your home directory ("cd ~"), then unzip the downloaded zip file. For the current release (2.7), that creates a "j2objc-2.7" directory:

Screen Shot 2021-01-20 at 11.33.59 AM.png

On my system, the red entries are for executable files, which includes the "j2objc" script missing from your build. Set J2OBJC_HOME to "${HOME}/j2objc-2.7" in your project's Settings.config should then fix your build.

--
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/a9b6eab7-1b4f-4b0f-abec-79ac575f42d5n%40googlegroups.com.

Kishore Prabhu Radhakrishnan

unread,
Jan 27, 2021, 12:03:26 AM1/27/21
to j2objc-discuss
Thank You Tom, It works fine
Message has been deleted

Tom Ball

unread,
Jan 28, 2021, 11:57:37 AM1/28/21
to j2objc-discuss
There's no magic to Xcode, j2objc, or iOS development: if a project points to a path that doesn't exist, the build will fail. Once that path is fixed and/or the missing file(s) are installed, the build will work. If you've never worked with command-lines before, find a tutorial.

"J2ObjC_source.h' file not found":
  • Open your project's System.config file, and copy what J2OBJC_HOME is set to.
  • In a Terminal window, type "ls " and paste in the path you copied. You should see the same list of files I posted previously: BUILD, LICENSE, WORKSPACE, etc.
    • If you don't see the same file set, fix your path so it points to the correct place you unzipped the j2objc-2.7.zip file.
    • Don't use "~" in System.config, use the actual path. To see what that is, run "cd && pwd".
  • Type "ls ", that J2OBJC_HOME path you copied, and "/include". You should see J2ObjC_source.h listed.
    • If you don't, delete the whole J2OBJC_HOME path, unzip the j2objc-2.7.zip file again, and try again.
  • In your Xcode project, bring up the project settings and click the Build Settings panel.
    • Search for Header Search Paths. It should be "${J2OBJC_HOME}/include"; if not, fix it.
    • In Framework Search Paths, add "${J2OBJC_HOME}/frameworks"
    • In Other Linker Flags, add "-liconv" (needed for locale conversion).
If none of this works, give up (seriously). j2objc is designed for very large, cross-platform apps, which are generally created by teams of experienced software engineers. For small apps, it is both easier and faster to rewrite the app from scratch, sharing only the app's design and resources but no code. j2objc should never be a way for Android developers to avoid learning iOS development, as that's a disservice to the app's users.

On Thu, Jan 28, 2021 at 4:20 AM Kishore Prabhu Radhakrishnan <kish...@payoda.com> wrote:
Hi Tom, 

I am not able to solve the below error. Can you please help me 
"J2ObjC_source.h' file not found"


On Thursday, January 21, 2021 at 1:09:51 AM UTC+5:30 Tom Ball wrote:

Tom Ball

unread,
Jan 28, 2021, 12:00:08 PM1/28/21
to j2objc-discuss
FYI: there are example Xcode projects in the j2objc distribution. You can test your build environment by opening j2objc-2.7/examples/Hello/Hello.xcodeproj, which should just build and run. Assuming that works, that project's layout and build settings can be compared with other projects.
Reply all
Reply to author
Forward
0 new messages