aspose file tools*
The moose likes JavaFX and the fly likes JavaFX for All Platforms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "JavaFX for All Platforms" Watch "JavaFX for All Platforms" New topic
Author

JavaFX for All Platforms

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Is it true that one program written in JavaFX can run on multiple platforms, including desktops, browsers AND micro-devices like iPhones and Palm Organizers?

-Cameron McKenzie
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

About as true as saying Java is write once, run anywhere. For example, If you want JavaFX applications to work across all these platforms, don't wrap any Swing components in your app.


GenRocket - Experts at Building Test Data
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

>>About as true as saying Java is write once, run anywhere.

Well, that's never been true for divergent platforms, nor was it ever really the promise. That motto was really more applied to desktop apps than anything else. A Java program written for the desktop was never intended to run as an HTML page or a micro-device. And an applet was never really indented to be run as a Java application. I mean, an Applet doesn't have a main method.

I thought the promise of JavaFX was that one program developed naturally could run as a desktop app, micro-device app and as a web page. Is it anything close to this?

-Cameron McKenzie



Eric Bruno
author
Ranch Hand

Joined: Jun 15, 2009
Posts: 60
As a general rule, if the device supports the JavaFX Mobile platform, it should be true (even if you wrap Swing). That doesn't mean it will run on ANY mobile device. For instance, the two you mention don't even support Java, so no JavaFX there either.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Remember when Sun said JSF was going to have all these renderers that would allow JSF to work on all sorts of platforms, devices, etc? ;) Ok, last comment from me. I'll let someone that might really know what's going answer.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Heh...Yeah, I do accept that the device will need to support Java. That is a cool plus.

-Cameron McKenzie
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Cameron Wallace McKenzie wrote:>>About as true as saying Java is write once, run anywhere.

Well, that's never been true for divergent platforms, nor was it ever really the promise. That motto was really more applied to desktop apps than anything else. A Java program written for the desktop was never intended to run as an HTML page or a micro-device. And an applet was never really indented to be run as a Java application. I mean, an Applet doesn't have a main method.

I thought the promise of JavaFX was that one program developed naturally could run as a desktop app, micro-device app and as a web page. Is it anything close to this?

-Cameron McKenzie

if you watch the general session videos from JavaOne, I think you'll see the "Rock 'n Rolla" app running on the desktop, in a browser, and on a cell phone. I don't think they showed it on a TV, but I'm pretty sure it was on the other three.

Burk


SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
Jim Clarke
author
Ranch Hand

Joined: Jun 15, 2009
Posts: 49
As long as you stay with classes in the "Common" profile, it will run as is on all three platforms. Obviously, you may have to deal with different screen sizes, but it is all the same code. Swing is only on the "Desktop" platform.
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Burk Hufnagel wrote:
Cameron Wallace McKenzie wrote:>>About as true as saying Java is write once, run anywhere.

Well, that's never been true for divergent platforms, nor was it ever really the promise. That motto was really more applied to desktop apps than anything else. A Java program written for the desktop was never intended to run as an HTML page or a micro-device. And an applet was never really indented to be run as a Java application. I mean, an Applet doesn't have a main method.

I thought the promise of JavaFX was that one program developed naturally could run as a desktop app, micro-device app and as a web page. Is it anything close to this?

-Cameron McKenzie

if you watch the general session videos from JavaOne, I think you'll see the "Rock 'n Rolla" app running on the desktop, in a browser, and on a cell phone. I don't think they showed it on a TV, but I'm pretty sure it was on the other three.

Burk

That is only for show, they made it be able to run smoothly for presentation purpose. If you have used SWT to develop desktop applications, you will know Write Once Run Anywhere was a joke.
Ok, it runs, but runs incorrectly.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Kengkaj Sathianpantarit wrote:That is only for show, they made it be able to run smoothly for presentation purpose.
Are you saying that the JavaOne demos were faked, or that they made JavaFX run smoothly so that JavaFX aplications present themselves well, i.e. provide a better user experience?

Kengkaj Sathianpantarit wrote:Ok, it runs, but runs incorrectly.
OK, I'll bite, what do you mean by 'it runs incorrectly'?
Jim Clarke
author
Ranch Hand

Joined: Jun 15, 2009
Posts: 49
From personal experience, the same JavaFX code runs on the Desktop, Mobile, and TV. Obviously, you need to consider screen size and stick with the common profile classes (No Swing), but it is exactly the same code.

BTW: the exact same JavaFX code can run as a standalone client application, an applet or as Java Webstart. That is the beauty of JavaFX.
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Jim Clarke wrote:From personal experience, the same JavaFX code runs on the Desktop, Mobile, and TV. Obviously, you need to consider screen size and stick with the common profile classes (No Swing), but it is exactly the same code.

BTW: the exact same JavaFX code can run as a standalone client application, an applet or as Java Webstart. That is the beauty of JavaFX.

Jim,
Thanks, that's what I understood to be the case too. I wonder if Kenkaj was just trolling and I foolishly took the bait.
Burk
Jim Connors
Greenhorn

Joined: Jun 15, 2009
Posts: 1

I just went through this exercise on two JavaFX applications that were written early on. In the first instance, the movement from desktop to mobile was transparent. The exact same code works on both platforms. Of course, you'll need to understand the least common denominator among JavaFX platforms. For example, the mobile platform doesn't currently support effects, so be careful when using these if you want truly portable code.

In the second instance, moving from desktop JavaFX to JavaFX Mobile had problems because the code made calls to Java methods only found in Java SE, not the underlying Java platform which is part of JavaFX mobile. So in reality this is a Java issue not JavaFX.

In short, my experience is that JavaFX portability is much improved over Java, which one can argue is a very portable platform already.

-- Jim C
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Thanks for the clarification!

-Cameron McKenzie
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Jim Connors wrote:In short, my experience is that JavaFX portability is much improved over Java, which one can argue is a very portable platform already.

Cool! That's what I was hoping for.

Thanks for sharing your experience,
Burk
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Burk Hufnagel wrote:
Kengkaj Sathianpantarit wrote:Ok, it runs, but runs incorrectly.
OK, I'll bite, what do you mean by 'it runs incorrectly'?

Try to develop an application using SWT, and run on Windows, Mac, Linux, you will get what I mean.
Before jump to a conclusion that somebody is trolling, you should have an evidence. What I said is true, you can ask anybody who used to develop SWT applications and run in several platforms.

I wonder, JavaFX aside do you really believe write once run anyway motto is true?
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Kengkaj Sathianpantarit wrote:Try to develop an application using SWT, and run on Windows, Mac, Linux, you will get what I mean.
Before jump to a conclusion that somebody is trolling, you should have an evidence. What I said is true, you can ask anybody who used to develop SWT applications and run in several platforms.

I wonder, JavaFX aside do you really believe write once run anyway motto is true?

I don't know about anywhere, but I can tell you that at work we write on Windows and Linux based machines for deployment on Sun Solaris boxes and the code works happily. I'm talking about server side stuff so SWT doesn't enter in to it.

Actually, now that I think about it, isn't SWT a lightweight wrapper on top of native controls? Perhaps you should use Swing instead. We have a Swing-based client and it seems fine on Windows and Linux.

If you want Write Once Run Anywhere you probably need to use Swing (or JavaFX) instead of SWT.

Burk
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaFX for All Platforms