3

I'm looking to get started with mobile development (specifically iOS), and while I'm usually pretty good at learning languages, Objective-C confounds me at almost every turn. So, looking at j2objc (because I already know Java), I think it might fit the bill in terms of what I'm looking for.

My question, though, is pretty simple: can the converter properly handle a situation where my source code references, say, Apache Commons code in a binary-only (bytecode) JAR file?

Chris
  • 1,119
  • 1
  • 8
  • 26
jzeitler
  • 71
  • 2

4 Answers4

5

No, j2objc requires source code (it uses the front-end of Eclipse's compiler). The RoboVM project works from class files, though.

Brian White
  • 8,332
  • 2
  • 43
  • 67
tball
  • 1,984
  • 11
  • 21
  • I am confused by this answer, "Yes j2objc it does work on binaries, it requires source code" seems like it contradicts itself? – samirahmed Apr 10 '15 at 16:54
  • 1
    It's a source code translator, so it requires Java source files. It does not translate class files, nor does it translate "binary-only (bytecode) JAR file[s]", which mostly contain class files. If you don't have the source for a project, this tool won't help. – tball Apr 12 '15 at 16:10
  • The answer should be: No: j2objc requires source code. However j2objc allows transpiling source code that references .jar files. However the jar files with .class files wont be transpiled. – TjerkW Sep 22 '16 at 10:03
0

J2objc is good for writing business logic only once. If you plan to write an app for Android, iOS and GWT, use it. But you will always need to write native code for UI, network and other specific platform stuff (Camera, Geoloc., etc.). If you plan to become a mobile development expert, my advice is to start learning Objective-c right now (I was just like you 2 years ago. I invested time to learn Objective-c and it's the only way to become a cross-platform mobile geek :-). I started with this book : Programming in Objective-C 2.0 (Stephen G. Kochan). Good luck !

antoine
  • 803
  • 7
  • 11
0

No: j2objc requires source code. However j2objc allows transpiling source code that references .jar files. However the jar files with .class files wont be transpiled

TjerkW
  • 2,086
  • 21
  • 26
-1

I am coming from Java background as well and learned Objective-C by myself (and taught it as well).

If you really want to develop mobile apps for iOS the best thing is to invest in learning Objective-C. J2ObjC is not sufficient to create iOS apps since it does not provide UI support and it is not stable yet (between alpha and beta quality)

J2ObjC does not provide any sort of platform-independent UI toolkit, nor are there any plans to do so in the future.

Objective-C looks strange in the beginning, especially for people with Java or C/C++ background, but once learn it; you will start to appreciate the language.

This is an excellent course to get you started and apple provides excellent resources to learn iOS development and Objective-C.

I strongly doubt that any language translation tool ,e.g. J2ObjC, will be sufficient to build good iOS apps.

iTech
  • 18,192
  • 4
  • 57
  • 80
  • I know it's not going to be any good for UI code, but in terms of business logic it would be nice to know if I need to get source for any components I need to add. Learning Obj-C is on my list, really... eventually... – jzeitler Feb 08 '13 at 21:39
  • 1
    J2ObjC is not stable, so weather it will work on no with a certain library need to be tested. But in general, J2ObjC takes the **java source** as input, so if you refer to external jars, I believe you will need the source for that. – iTech Feb 08 '13 at 21:48
  • Just because something is alpha or beta does not mean it's unstable. J2ObjC misses some features yet, but the core is stable and functional. – Pascalius Apr 01 '13 at 18:19