aspose file tools*
The moose likes iOS and the fly likes Is it possible to convert java code to objective c? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Is it possible to convert java code to objective c?" Watch "Is it possible to convert java code to objective c?" New topic
Author

Is it possible to convert java code to objective c?

padraig dillane
Greenhorn

Joined: Nov 25, 2011
Posts: 3
Hi all,

Im a newbie to the world of programming and have only been learning Java for 3 months. Im finding it hard and beginning to question will it ever make sense and could I make a career out of it My goals were to pass the SCJP exam/get a job/make phone apps. One day I was looking up iphone development just to see what i could be doing with Java in the future. To my horror I realised Java had nothing to do with iphone development it was objective C . I did more research and people are saying obj c is a harder lanuage to learn. Im struggling with Java so learning oblective c would be mission impossible. To make a long story short is there any way to convert java code to objective c?

Thank you in advance.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

I'm not aware of any code converter, I don't like to take this route personally any way.
Don't try to learn two languages concurrently, switching the context between the two of them is going to damage your learning process.
The good news is there are a lot of similarity between Java and Objective-C, yes that including automatic memory management.

If you want to learn Objective-C and iOS development at the same time, then have a look at this book: Objective-C Fundamentals.
The mission isn't impossible, it is doable
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4637
    
    5

Hussein Baghdadi wrote:The good news is there are a lot of similarity between Java and Objective-C, yes that including automatic memory management.


Well, there is a certain commonality of all modern languages, so there are similarities, but I would not call it "a lot". I do agree that once you know two or three languages, adding the next one is nearly trivial.

While Objective-C does have automatic memory management when running on OS-X, it does *not* have it on IOS. That feature is missing from the embedded operating system.

Proper IOS applications must be designed as IOS applications, with the toolset and frameworks that IOS provides. Even if there were a conversion tool, the resulting code would not look and feel like a proper IOS application.

If your must learn to write Objective-C on IOS as your very first programming environment, I wish you the best of luck. I'd start with something a bit less challenging, but that is just IMHO.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

On a side note, iOS 5 has Automatic Reference Counting now, makes memory management the job of the compiler.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4637
    
    5

Hussein Baghdadi wrote:On a side note, iOS 5 has Automatic Reference Counting now, makes memory management the job of the compiler.

The job of Memory management belongs somewhere automated. Its good that IOS 5 has finally supported this. Too bad it will take years before we can rely upon it, as there are literally millions of devices that will never run IOS 5
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Why "will never run iOS5" ? Any proof or known reasons?
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4637
    
    5

Lots of old iPhones were left off the upgrade path. I don't remember the details of which, and when. This is not just an Apple thing, nearly all vendors have minimum hardware requirements for upgrades. Just as modern HTML 5 code can't run on ancient versions of Microsoft IE.
padraig dillane
Greenhorn

Joined: Nov 25, 2011
Posts: 3
Thanks to all who replied. Ill keep slogging away with the Java
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1511
I would agree with Husseini of not trying to learn two things. I can not appreciate the similarity between Objective-C and Java, but if there are any, I think they may have to do with syntax. I think C is always known to sit closely with the hardware while, Java relies mostly on the JVM. Coming to iPhone/Apple, somewhere Steve had repeated Alan Kay's quote,
"People who are really serious about software should make their own hardware."


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Tejas Shah
Greenhorn

Joined: Oct 26, 2009
Posts: 23

If all you want is mobile development,

you must consider phonegap and jquery mobile. This supports most of the current smartphone OS. I suggest not to limit your scope to one specific platform, as platform independence is very impressive.

These two frameworks lets you create mobile app mostly out of simple HTML/CSS !!

-Tejas
Cherish your life...!!
Steffen Luypaert
Greenhorn

Joined: Jun 08, 2005
Posts: 4
Some time ago, I wrote this article on starting with ObjectiveC development as an Android/Java developer.
Basically, it is not possible to convert Java code automatically, but as a Java developer, it is quite easy for me to map an Android app to an objectiveC equivalent.
Android code can pretty much be literally translated line per line to ObjectiveC(not taking into account the infrastructural differences, of an Activity vs a ViewController for example), without a lot of rethinking/refactoring.

And ARC is compatible with iOS 4.0 on, making it viable for most projects, since most iOS apps target only from 4.0 anyway.
There are some situations in which you cannot use it yet though, like when using third party libs that do not have conversions yet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to convert java code to objective c?
 
Similar Threads
iphone development
iphone development
May involved in Ipad app development, JAVA, I mean along with obj-C...?
Java for Android
Iphone dev requirements?