BT

InfoQ Homepage News Java on iOS and Android via Gluon

Java on iOS and Android via Gluon

Bookmarks

Gluon has released beta support that enables JavaFX applications to run the same code across PC, Mac, iOS, and Android. As a result, developers can use a language and tools that they already know, managing one codebase per application instead of per device.

The toolchain expands on work done in 2015 by José Perada and Bruno Borges who produced a JavaFX game for Android called 2048FX. Gluon has also pushed for mobile Java since Java 9. For running on iOS, Gluon's suite of tools includes a few notable aspects that are automated through a build pipeline:

  • OpenJDK libraries are brought in as static libraries compiled for the target platform.
  • OpenJFX is the graphical framework for user interaction, available for all target platforms.
  • GraalVM in native mode provides the key runtime that is built for the target platform.

When combined through the javafxmobile plugin, the end result for iOS and Android is a native application in binary form. Unlike a typical Java application on a desktop or server, the iOS and Android applications are completely Ahead of Time (AOT) compiled, native, and do not use bytecode or Just In Time (JIT) compilation.

AOT compilation is used to provide direct access to the device and faster startup time. For server-based applications, Andrew Dinn has a technical analysis of why AOT is not necessarily faster than JIT. They are each options, and within Gluon’s stack, the choices favor AOT.

Gluon’s new release comes approximately two years after Shai Almog, CEO of Codename One, stated that "Gluon is dead as RoboVM is." RoboVM was a similar project that ran JavaFX across mobile. That claim follows a similar path where technologists and reporters have made careers out of claiming that Java is dead (it isn’t). In 2016, Redmonk identified that saying "Java is dead," is dead. Almog’s second claim regarding RoboVM was partially correct, as RoboVM was acquired by Xamarin, who was acquired by Microsoft, and integrated into the Visual Studio stack. While names have changed, the documentation and materials remain available.

Developers looking to build JavaFX applications for iOS can consult Gluon’s documentation. A separate tool, SceneBuilder, can be used to help design a user interface that will run across each platform. Visual libraries are available through many channels, where Jonathan Giles periodically aggregates and reports on JavaFX activity. Giles is the author of major libraries ControlsFX and Scenic View. ControlsFX is a suite of interactive visual components, and Scenic View is an analyzer that helps inspect running graphical layouts.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Great Journalism quoting me without reaching for comment first...

    by Shai Almog /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    How is this "alive"?

    Notice this is a PR about a product promised ages ago with not a single statistic or supporting fact.

    Who uses it?

    What apps were built with it?

    Is this "native", if so how big are the applications? How do they perform?
    Does it support newer core features in mobile OSs such as bitcode which is essential for iOS?

    The fact that people produced a new release doesn't make this a "product" or alive. It's as dead now as it was back then.

  • Re: Great Journalism quoting me without reaching for comment first...

    by Cameron Purdy /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Wow! Don't hold back ;-)

    Is there some more information that you know about this space that you are using as the basis for your comments? (I am legitimately curious.)

    Reading the description (without having any experience with this specific approach), it sounded both reasonable and promising. But I'd love to know more, including whatever it is that you seem to know ...

  • Re: Great Journalism quoting me without reaching for comment first...

    by Shai Almog /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Using my name in promotion of this re-hashed nonsense is infuriating. Had they not mentioned my name I wouldn't bother commenting... We founded the one company in this field that actually implemented this at scale (for non-gaming apps) and has deployments on iOS/Android since 2012 (Codename One).
    Before that I worked on mobile development at Sun (since the 90s) in the team that built the first widely successful mobile development tool and later in the team that built one of the early cross platform frameworks. I also worked in the office next to the guys working on JavaFX embedded and worked on some of the early mobile JavaFX code.

    The core problem with their approach is JavaFX and Oracle's stubborn approach in regards to Java. JavaFX is too big. ARM code is roughly 5x the size of the equivalent bytecode. If you want to support slightly older 32bit devices you can double that number. So for a 1mb app jar you'd have a 10mb app. Typical JavaFX products reach 100mb+ in size whereas a Codename One app of roughly the same scale clocks at 5mb. This is made worse by appstore deployment which further increases the size of the deployed app.

    Another problem is the chosen architecture. iOS is generally a problematic target. Apple moves things around at a moments notice. E.g. they decided to move to 64 bit and did that within months. This was traumatic for vendors such as RoboVM. Since then Apple introduced bitcode which isn't a requirement (yet) but might be. Because of the way their VM is built targeting bitcode would be hard/impossible.

    I can go on but honestly people have been selling the JavaFX on iOS crap since 2013. So far there was no movement on this. This is further frustrating as JavaFX is presented as "the standard". It isn't. The mobile version isn't standardized. It's an expensive paid product with licensing costs. Our product is free to use and has 0 licensing cost... The paid features are far more extensive and also far more affordable.

  • Re: Great Journalism quoting me without reaching for comment first...

    by Erik Costlow /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Hi Shai, thank you for commenting. I picked your quote up from a public mailing list discussing Gluon. The context in which it is used is to backtrace the declaration that the company and technology was dead, comparing it to the similar "Java is dead" stories. Both are doing fine.
    I reached out to Gluon to answer the other questions:
    The typical size of an app is 6 to 100MB, in line with other apps. For example GMail on iOS is approximately 170MB and Spotify is 92MB.
    This release supports bitcode.
    Only one OpenJFX exists; the same thing works on PC and mobile.
    The cost of using these tools is $0 and developers can use github.com/gluonhq/client-maven-plugin without communicating with Gluon.
    The Devoxx app at apps.apple.com/us/app/devoxx/id1094805620 was made with (an older) Gluon. It may be updated to this new framework closer to when the conference happens.

    I cannot address the other comments, as they involve interpretation. You have strong knowledge of this area and I am glad that Codename One is also doing well.

  • Re: Great Journalism quoting me without reaching for comment first...

    by Shai Almog /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    > The typical size of an app is 6 to 100MB, in line with other apps. For example GMail on iOS is approximately 170MB and Spotify is 92MB.

    That's phrased in typically misleading double speak. You can't compare the size of an app that uses 30+ libraries and has thousands of hidden features/resource objects (like these HUGE apps) to a hello world application. A native iOS app with all the bells and whistles can be 5mb in size. A hello world Gluon app can't be under 100mb in a production build. That's a starting value... If you add in SDKs and resources we're talking 200+.

    > This release supports bitcode.

    Is there a corroborating link for this? I scored their bare site for a mention of this and couldn't find any. Since their product is based on OpenJDK as far as their website claims I find this surprising.

    > Only one OpenJFX exists; the same thing works on PC and mobile.

    Sure. But it's not a standard for mobile. And frankly not much of a standard like Swing was but that's another story. If we assume FX is a "standard" then the mobile version of it has "some" baring but to get into mobile you need a lot of surrounding API's that aren't a part of FX proper. You can't download an Oracle iOS SDK and you have to pay licensing for this.

    > The cost of using these tools is $0 and developers can use github.com/gluonhq/client-maven-plugin without communicating with Gluon.

    Does this work for iOS?
    If so I stand corrected on this point. But to be fair their website is seriously misleading on this matter... The free column explicitly excludes iOS/Android from the options when building an application: gluonhq.com/products/mobile/buy/

    > The Devoxx app at apps.apple.com/us/app/devoxx/id1094805620 was made with (an older) Gluon. It may be updated to this new framework closer to when the conference happens.

    There was also 2048 and an old JavaOne app. These are things built by the gluon team or people close to them as part of JavaFX advocacy efforts. Not 3rd party clients. I tried the devoxxx app when it came out. I hope the current version was improved in terms of animation fluidity. It does demonstrate the size issue I mentioned before though, the app is relatively simple but pretty big. Since a developer is typically remote at a conference and might not have roaming enabled, expecting him to download 100mb+ on a mobile device doesn't make sense.

  • Re: Great Journalism quoting me without reaching for comment first...

    by Erik Costlow /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Thanks again Shai.
    To avoid product promotion, I had checked the pricing page before writing this. Both Android and iOS looked available at no cost, and Gluon confirmed this in their previous message where I asked your questions.
    The free $0 column from your link directly mentions iOS and Android, "Deploy to Desktop / Android / iOS / Embedded."
    They indicated support for bitcode. While they may have tools within their own stack, it is also helped from the GraalVM team which handles bitcode: github.com/oracle/graal/blob/master/substratevm...

    Beyond that, I cannot speak to size beyond the number they provided earlier (between 6 to 100MB). As the toolchain is available to try at no cost, I am certain people can try it and see. I think the current iOS cellular download limit is 200MB.

    As for standards, you are correct that there is no standard: it's not Swing, it's not JavaFX, and it isn't any other framework. People are open to choosing any framework, including Codename One.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.