Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaFX for All Platforms

 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>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
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heh...Yeah, I do accept that the device will need to support Java. That is a cool plus.

-Cameron McKenzie
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jim Clarke
author
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the clarification!

-Cameron McKenzie
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic