51

I was wondering if is it possible to develop iPhone applications using Java plus XMLV, which claims to cross-compile Java-based Android applications to native iPhone applications.

Is XMLV a viable way to develop iPhone applications using Java?

Here are a few Java code examples used to build and application in an iPhone:

http://www.xmlvm.org/iphone/#

3

18 Answers 18

36

I think we will have to wait a couple of years more to see more progress. However, there are now more frameworks and tools available:

Here a list of 5 options:

3
  • 1
    Good list, these seem like they may be the top ones.
    – setherj
    Jul 2, 2014 at 22:46
  • 1
    RoboVM is closed. robovm.com/robovm-winding-down Aug 1, 2016 at 21:39
  • It seems like Gluon product could also be listed here. I cannot edit this answer as there are too many open edits ATM it says. But I also think this answer is the most helpful right now.
    – Luke 10X
    May 25, 2023 at 12:03
33

If you've completed your other projects, why not take the time to learn Objective-C? There is a ton of material out on the web to help you get started. Honestly, it won't be that hard and learning to do some memory management will be a great learning exercise. Have you programmed in C before?

Most cross compilers won't do a great job in converting your code, and debugging your project may become much more difficult if you develop them this way.

7
  • I know C++, C#, and some C...so yes I've done SOME C before... Jan 12, 2010 at 17:42
  • 3
    The major difficulties for Java/C#/ActionScript/JavaScript folks are (1) the existence of and syntax for pointers and (2) manual memory management. Since you have some C++ and C under your belt, you should be able to pick up Objective-C relatively easily. Jan 12, 2010 at 20:54
  • 2
    Now it is possible with phone gap framework
    – Pratik
    Oct 15, 2012 at 12:09
  • 1
    The link to the tutorial is dead. Feb 21, 2017 at 21:58
  • 3
    -1 because this doesn't answer the question of "how to code with Java in iOS". I value the content of this answer, but it's not appropriate as an StackOverflow answer. This answer is discussing the benefits of taking a different approach, and the question seems to be clear about the need of not using a Mac nor Objective C.
    – Seb
    Jun 7, 2017 at 13:47
26

I think your teacher sent you down the wrong path.

This is a classic example of trying to put a square peg into a round hole. The best way to develop for the iPhone is with the iPhone SDK and objective C. The best way to develop for Andriod is Java and the Android SDK. The best way to develop for WinMobile is C#/VB and the .Net Framework.

As you can see each has their own "best" SDK. Since you are only learning Java I would second the suggestion to play around with Java and Android.

3
  • Well, I do know C#, some C++, and other languages, so maybe learning Objective-C won't be too hard for me. I'm just trying to get an idea of how difficult it would be if I were to use Java. My teacher just threw this at me today... Jan 12, 2010 at 17:40
  • 2
    Don't spread yourself too thing either, people have a habit of being aware of many languages but not very good at one. I would suggest to leave objective C off the list for a while and go play with the many Java SDK's that are floating about.
    – deanvmc
    Jan 12, 2010 at 20:52
  • Learn as many languages as you can. It will give you an appreciation of the power (and weaknesses) of each. I, personally, know about 10 languages—although I admit I’m rusty in some of them. Feb 21, 2017 at 15:04
10

There is anew tool called Codename one: One SDK based on JAVA to code in WP8, Android, iOS with all extensive features

Features:

  1. Full Android environment with super fast android simulator
  2. An iPhone/iPad simulator with easy to take iPhone apps to large screen iPad in minutes.
  3. Full support for standard java debugging, profiling for apps on any platform.
  4. Easy themeing / styling – Only a click away

More at Develop Android, iOS iPhone, WP8 apps using Java

6

take a look at codenameone.com project, it's a cross platform mobile framework where the ui part is a fork of LWUIT. This project leverage xmlvm to translates the java bytes code to Objective C

5

You can also take a look at RoboVM.

It translates Java byte-code into native ARM or x86 code which can run directly on the processor without any VM or interpreter needed. Most of the Obj-C UI elements are already bridged into Java and follows the usual Java design patterns.

Edit Robo VM recently announced that it would be shutting down the service - Source

1
2

You need to know at least basics of Objective-C to develop for iPhone. However, it is possible to use C++ classes.

As far as I know Adobe is working on building Flex/Flash applications for iPhone. Read more here: http://theflashblog.com/?p=1513

1
2

You can't.

Note however that Monotouch allows you to develop in C# instead of Objective-C. http://monotouch.net/

1
2

If you plan on integrating app functionality with a website, I'd highly recommend the GWT + PhoneGap model:

http://blog.daniel-kurka.de/2012/02/mgwt-and-phonegap-talk-at-webmontag-in.html http://turbomanage.wordpress.com/2010/09/24/gwt-phonegap-native-mobile-apps-quickly/

Here's my two cents from my own experience: We use the same Java POJOs for our Hibernate database, our REST API, our website, and our iPhone app. The workflow is simple and beautiful:

Database ---1---> REST API ---2---> iPhone App / Website

  • 1: Hibernate
  • 2: GSON Serialization and GWT JSON Deserialization

There is another benefit to this approach as well - any Java code that can be compiled with GWT and any JavaScript library become available for use in your iPhone app.

1
  • Definitely anyone starting out from Java should be looking to write HTML5 frontends which work with desktop and mobile browsers and that can use Apache Cordova (phone gap) to be bumbled into native apps on every possible phone and tablet. Use jquery mobile as the skin and jquery for the Ajax then on the Java webserver try out a few technologies to see which ones are easy (eg Spring Boot is highly productive, modern, but good for s CV as a bridge into (possibly legacy) enterprise Java). For bonus marks use websockets not Ajax which will excite potential employers).
    – simbo1905
    Nov 10, 2015 at 8:16
2

I'm answering this question 2 years down the line and I must stress that I did have pretty much the same problem as you did. However I'm so happy that Android has evolved into what it is today.

Having said that, I do regret that I did not learn C/C++ while I could have and I don't want to blame my teachers for it cos where was my brain when the time was right?

I'm sunk in Java today and I'm glad that I did not make the mistake of learning too many languages and being less productive... However I did learn HTML5 which really made things a lot easier, maybe someday, I might get motivated to learn C/C++ . Or if I get an Apple mac at a real throw-away price, I might learn Objective-C :)

1
  • Id say 1 year to master java, 3 years to master C++, and 3 months to master HTML5
    – Jonathan
    Dec 18, 2018 at 9:45
2

I think Google Open Sources Java To Objective-C Translator will make it possiblöe to develop in Java for iOS https://code.google.com/p/j2objc/

2

try to use TotalCross. It is a Java Framework to help devs create iOS and Android apps with only one source code. Different from the others platforms, it doesn't require any knowledge in iOS (Objective-C or Swift) nor Android (SDK or NDK)

there is a maven integration https://gitlab.com/totalcross/TotalCross/wikis/building-with-maven

2
  • Just a heads up this question is from 2010... May 5, 2017 at 19:58
  • @BrendanLesniak: So what? More recent answers to a topic that evolves as much as this one are always welcome, I'd say Even more so since it is still a Google top hit in 2020...
    – cupiqi09
    Apr 14, 2020 at 15:03
1

http://www.xmlvm.org/android/

Specifically talks about Java based Android apps being ported to the iPhone using non-Apple hardware.

You might also want to check out MonoTouch (C# rather than Java...but the two are very similar).

1
  • Would help, but we only have a java compiler at my high school, though I do know C#... Jan 12, 2010 at 17:41
1

Perhaps you should consider Android applications instead of iPhone applications if you really want to develop in Java for smartphones. Android natively uses Java for it's applications; so perhaps this might be a better option?

As for iPhone, I would recommend you to look into Obj-C or C/C++ depending on the type of applications you want to make. Should be fun to dabble into a new language! :)

1

You can try iSpectrum ( get it at http://www.flexycore.com ) You'll be able to develop and debug your Java apps in Eclipse. You'll still need a Mac and XCode to launch it on the simulator, or install it on the real device, though. But you won't have to actually use XCode editor. Plus you can use it for free if you're planning to work on an open source project.

1

To add to this there's: http://www.oracle.com/technetwork/developer-tools/adf-mobile/overview/index.html

A Java & HTML5 Based Framework for Developing
Oracle ADF Mobile enables developers to build and extend enterprise applications for iOS and Android from a single code base. Based on a hybrid mobile architecture, ADF Mobile supports access to native device services, enables offline applications and protects enterprise investments from future technology shifts.

0

Even if the question states Java, most of the answers have digressed. So I thought I would do the same :)

We have been using Adobe AIR for the last 5 years and it is truly cross-platform and provides native-like performance with the same code base (at least 99% of our code is the same). Adobe AIR got some bad press at the beginning during the 'beta' period (slow, no GPU, Flash 'dead' etc.) But now, it's amazing what you can do with it. Not to mention the wealth of open source libs out there.

With the same code base you can push your app onto:

  • iOS
  • Android (x86 and ARM)
  • Flash (still VERY useful)
  • ChromeBook
  • PC (as native with installer)
  • Mac (as native with installer)

Why bother with Java or Objective-C ?

The only common platform not covered is Window Phone. But that's coming soon too.

2
  • This question was asked in end of 2009, beginning of 2010... but thanks for your input anyway. May 28, 2015 at 21:26
  • So the question is "how"? Jan 21, 2022 at 18:35
-1

Build a hybrid app. Anyways Java is not enough for a software engineer , you need to learn JS,HTML5,CSS as well for becoming a full stack mobile/app developer. Build the complete backend using Java & frontend using Cordova/Phonegap.

I'm assuming you dont need the last drop of juice from the hardware even hybind app should suffice your needs.

Build a responsive webapp using Bootstrap 4 + React JS. Use https://github.com/ipselon/structor to quickly build up the frontend. Now the web app becomes an app in the browser.

You could also take the same app and build it using cordova to publish a app on ios/android platform.

2
  • 2
    This question was asked years ago by myself (almost 7 years ago...). Anyway, yeah Java must not be enough for a Software Engineer; but it sure pays my 6 figure salary. Yep. Not enough. Aug 21, 2017 at 20:11
  • Because this page is turning up in the results and there will be people stumbling upon this page.
    – Rohitdev
    Aug 26, 2017 at 9:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.