What platforms JavaFX is/will be supported on? - java

I have read about JavaFX, and like all new technologies I wanted to get my hands "dirty" with it. However, although it talks of multiplatform support, I can't find specifics on this.
What platforms support a JavaFX application? All those with Java SE? ME? Does it depend upon the APIs in JavaFX that I use?

JavaFX has three planned distributions.
JavaFX Desktop will run on Windows, Mac, Linux, and Solaris at FCS and will require Java SE. Support for Linux and Solaris will be forthcoming.
JavaFX TV and JavaFX Mobile have no announce target platforms. Also unannounced is whether they will run on ME or SE, and if ME which profiles.
One important platform distinction is that JavaFX Desktop will support Swing components while JavaFX Mobile will not (only scene graph for graphics). JavaFX TV the least publicly concrete of the three at this time.

From what I can see JavaFX is a whole new runtime and compiler so is not a subset of Java. Sun will support it on mobile phones and on the desktop.
OS-wise it is currently released for Windows/Mac but Solaris/Linux are in the works.

JavaFx is not a new runtime. It is the same JRE but a new language/compiler with some a few new APIs to make it all works....
Using Netbeans, you can build applications on any platform. As of today, the APIs are beta. Classfiles produced by the compiler are JRE 6 compatible.

Related

is java 9 and above still platform independent or not after this module system has been introduced?

I am not able to understand that after module system is introduced in our java language. Is java9 and above still platform independent or not ? I am asking this question because I have read that now every application will have its own jre inside it. So, how will this single jre run on all OS, like windows, Linux, or Mac OS.
You are conflating two different changes recently made to the Java platform:
Retiring of Java Web Start & Applet technologies
Modularization
Retiring desktop-technologies
Recently Oracle announced the phasing out of the Java Web Start technologies, in addition to the already-deprecated Applet technology. See item JDK-8184998 in Java 9 Release Notes:
Java Deployment Technologies are deprecated and will be removed in a future release
Java Applet and WebStart functionality, including the Applet API, The Java plug-in, the Java Applet Viewer, JNLP and Java Web Start including the javaws tool are all deprecated in JDK 9 and will be removed in a future release.
End-users will no longer be encouraged to install a JDK or JRE on their computer.
For more details, see the eight-page 2018-03 white paper from Oracle, Java Client Roadmap Update.
So then, how are developers of Swing or JavaFX apps to deliver their software to the end-user?
Oracle suggests packaging up your app along with a JVM & JRE for delivery as a single launch-ready applications on that appears on the client to be just another app alongside the native apps. Such “double-clickable” app-packaging has been commonly done on the Mac since the beginning of Java. But what was once an obscure art on other host environments (Linux, BSD, Windows, etc.) will now be the norm, as it is on macOS.
In yesteryear, bundling a Java runtime with your app required jumping over some licensing hurdles. The legalities have eased with arrival of the open-source OpenJDK project, and possibly with other implementations†.
You will need to prepare different releases of your app for each hosting environment. While your Java code runs independently of the host OS, the JVM is built of native code to interact with one specific kind of host. So you will need to build a Linux release with a Linux JVM, a macOS release with a macOS JVM, and so on. While that may seem like a downer, the upside is that you no longer need to worry about users having the wrong JVM version installed, or no JVM at all. Now the JVM’s presence and version are under your control. Your end-users and customers will no longer need to be aware that your app is Java-based.
Modularization
That need for app-packaging has nothing to do with the modularization of Java. As I said, it has been done for decades on the Mac.
What modularization brings to the party is that the JVM/JRE you bundle into your delivered app can be customized to contain only the Java Modules actually utilized by your particular app. This results in a smaller size, so your finished app is smaller, downloads are faster, less storage is used, and your app may load faster.
The open-source jlink “Java Linker” tool helps with the packaging work, so you can assemble and optimize a set of modules and their dependencies (only the ones actually called by your app) into a custom run-time image. This modular run-time image format is defined in JEP 220.
† On a related note, you may want to read the white paper Java Is Still Free to understand how and where to obtain a Java implementation for your app, and what support may or may not be offered in either free-of-cost or paid releases.
By the way, you may find helpful this Answer on a related Question, with a flowchart of choosing various sources of a Java implementation.
Is java9 and above still platform independent or not ?
Yes. It's as platform independent as it ever was. The module system has nothing to do with platform independence.
now every application will have its own jre inside it.
It doesn't have to, but it's more and more recommended as time goes on since fewer people have Java installed separately on their systems. This used to be a given, but that number has been declining for the last decade or so, and now (outside of Java developers) pretty much no-one has a standalone JRE installed.
how will this single jre run on all OS
It won't. You will bundle a separate JRE for each platform you want to distribute for. But JRE's for all platforms are still freely available, and the same Java code will still run on a JRE for any platform.
The module system doesn't influence the OS independency of java in general. Java applications that make use of the module system need to be run in a JRE. This can be either an OS specific pre-installed JRE as usual or a tailored runtime image (application embedded JRE) created with JLink.
The module systems main purpose is to provide you a managed way to split your application into different logical modules. E.g. into different .jar files that can be loaded at runtime - no matter on which operating system.
In summary, you have the following options:
Make sure that your client has the right JRE pre-installed. This could be dangerous, because (normally) you are not in control of his updating behavior.
Ship your application together with an official JRE.
Tailor your own, application and OS specific runtime image using JLink. Ship it bundled with your application.
But, suppose I do not know what OS my client would be running so how
the server will decide what image he should give to him. i.e., a Mac
Image, a Linux Image or a Windows exe.
You have to know the target OS and deliver the right runtime image.
While Java 9 makes it easier to ship a JRE which is more compact and specific to the needs of an individual application, you are not required to do so. If you were already planning to ship a JRE with your application it can be smaller with Java 9 than earlier versions.
It doesn't mean you have to ship a JRE, an application which wasn't shipped with a JRE is unlikely to start shipping with one now, and in fact Java 11 only ships as a JDK.
From this link on Java 9 features;
JLink allows you to create custom runtime images that only consist of your application modules and those JRE modules that your application requires. The result is likely a smaller runtime image, which uses fewer resources than a default JRE.

Is JavaFX complete replacement of Swing?

I had a Java Desktop Application in which graphical user interface had designed in swing. After we came to know that JavaFX replacing Swing We have replaced graphical user interface with JavaFX.
"6. Is JavaFX replacing Swing as the new client UI library for Java
SE? Yes. However, Swing will remain part of the Java SE specification
for the foreseeable future, and is included in the JRE. On one hand,
Swing is widely used in existing Java desktop applications, but relies
on an old architecture, which requires a certain level of expertise
and specialization. On the other hand, JavaFX features a set of modern
UI controls that can be skinned using standard CSS techniques. While
we recommend developers to leverage JavaFX APIs as much as possible
when building new applications, it is possible to use Swing and JavaFX
within the same application, allowing developers to extend existing
Swing applications."
Now we heard that Oracle donate the JavaFX toolkit to the open source community and OpenJDK Community had agreed to take it on.
The JavaFX toolkit evolved from the F3 project at Sun. Initial
releases were based around the JavaFX scripting language, however, in
2011 the toolkit was completely rewritten in Java and released by
Oracle as JavaFX 2.0. In October 2011 Oracle announced that it would
donate the JavaFX toolkit to the open source community and by November
2011 the OpenJDK Community had agreed to take it on.
I do not think so JavaFX is stable. It has no quick support. Document are not enough explanatory. It does not release internal memory when stage is closed. My application is multithreaded application and most of time taken by my application in updating status of each individual thread. Self contained copy of JRE in native bundle does not reliable, we have to replaced it with JRE folder that resides into JDK.
It's really frustrating and I wonder, if JavaFX is fit to develop the Java Desktop application.
According to Oracle, JavaFX is a replacement for Swing:
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6, question 6, says:
Is JavaFX replacing Swing as the new client UI library for Java SE?
Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and therefore included in the JRE. While we recommend developers to leverage JavaFX APIs as much as possible when building new applications, it is possible to extend a Swing application with JavaFX, allowing for a smoother transition.
Is JavaFX complete replacement of Swing?
I think that not,
most of components are halfsized in compare with Swing (price for development ???),
implementations in JavaFX8 (accesible with Java8) has one important point Swing JComponents could be accesible from JavaFX containers and JavaFX Components will be accesible in Swing JContainers (implemented in newer JavaFX2.2),
then JavaFX will be accesible for development of DeskTop applications
still question is if will be possible to add JavaFX TextArea together with Swing JTextArea in one JPanel or vice versa (Panel from xxx.scene.xxx)
more (the best infos, roadmap, development...) on FX Experience (notice occasionally is down :-)
Update as of 2020
JavaFX technology has been going quite well in the ensuing years after this Question was originally posted. Java is regularly released on its 6-month train schedule, and JavaFX releases have arrived at the same pace.
Oracle Corp. has completed the process of making JavaFX open-source, known as OpenJFX. The codebase is now housed as a sub-project on the OpenJDK project. Leadership has been assigned to the Gluon company, with Oracle’s continued support.
The popularity and community seem to be growing. The competitors have fallen away, such as Microsoft Silverlight and Adobe Flash both having died.
Oracle continues to support Swing as a required part of any Java SE implementation, but only in maintenance-mode. JavaFX, in contrast, is under constant active development.
Oracle sells support for JavaFX, as do other vendors such as Gluon and Azul Systems.
Some vendors supplying Java implementations bundle the JavaFX/OpenJFX libraries with their JVMs. These include Azul Systems with their ZuluFX product, and BellSoft with their LibericaFX product.
Though cutting-edge presently, there is work being done to build a native apps for iOS and other platforms using OpenJFX with ahead-of-time compilation using GraalVM.
Delivering a JavaFX desktop app is often done by bundling a JDK inside. This produces a “double-clickable” app. Bundling a JDK is more easily done by modularizing your code with JPMS. By leveraging JPMS, a developer can make use of the jlink and jpackage tooling.
See:
Java Client Roadmap Update by Oracle, 2020-05
JavaFX FAQ by Oracle
OpenJFX
JavaFX page on Wikipedia
OpenJDK wiki page for JavaFX

Any simple (and up to date) Java frameworks for embedding movies within a Swing Application?

I am building a small Swing application that I would like to embed a movie within. Importantly, this application is a WebStart application - and the library should be able to be packaged within the jnlp that I launch -i.e, not dependent on native libraries.
I am aware of and have tried JMF but the format compatibility I believe to be relatively poor when compared to other frameworks out there.
Could someone please provide a sample code snippet of a simple implementation using their recommended library?
Many thanks in advance.
Some considerations for JavaFX as a solution as a Java based media playback framework.
As of Jdk7u4, JavaFX is co-bundled with the jdk for Mac and Windows
(XP, Vista, 7, 32 and 64 bit).
JavaFX can be embedded in a Swing App.
JavaFX includes native libraries, but any Java Framework is going to need native libraries to do video well.
A comprehensive deployment toolkit is included with the JavaFX SDK and/or includes the ability to generate jnlp based deployments.
JavaFX 2.1 supports vp6 encoded flvs (older format) as well as some more modern and oft-used encoding formats such as mp4/aac/mp3.
JavaFX only supports limited media codecs and container formats, e.g. if you have a codec installed on your machine and can play a file encoded in that format in, for example chrome, windows media player, or flash that does not guarantee that the same file will play in JavaFX.
Playback of mp4 on XP or Linux requires a user to manually install the necessary codec, but other platforms (osx, win7, vista) do not require manual mp4 codec install.
Use of JavaFX on a mac requires the user to use OpenJDK 7 for Mac, not the Apple JDK.
JavaFX support for jnlp launched apps on Macs won't be available until later this year (2012) and similarly for Linux.
You could probably bundle the entire JavaFX platform with your app in a jnlp (though I haven't seen anybody do that yet).
The recommended method for a jnlp deployment would be to add a specification of a minimum JavaFX environment to the jnlp and have the JavaFX deployment toolkit and webstart take care of ensuring that it was present and installed correctly on the user's machine.
Interaction between Swing and JavaFX requires some inconvenience and care around threading and also a slightly different app launching code between Swing and JavaFX. Some people have complained about this on forums, most don't seem to have had too many issues.
For better or for worse (I believe better), JavaFX is likely the only media and client development framework from Oracle which is receiving ongoing major development and new features.
Eventually (this year or next) JavaFX will included in all new Java runtimes for all major consumer platforms which run modern versions of Java SE.
Community support for development in JavaFX from Oracle and 3rd parties is (I believe) good.
Here is a sample JavaFX app which plays a video:
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.media.*;
import javafx.stage.Stage;
public class VideoPlayerExample extends Application {
public static void main(String[] args) throws Exception { launch(args); }
#Override public void start(final Stage stage) throws Exception {
final MediaPlayer oracleVid = new MediaPlayer(
new Media("http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv")
);
stage.setScene(new Scene(new Group(new MediaView(oracleVid)), 540, 208));
stage.show();
oracleVid.play();
}
}
Although I have not had any problems with formats compatibility o JMF you can take a look in JavaFX that was designed to be a competitor to Flash, so should support all media formats and codecs.
You can also embed Flash player into java application using JNI/JNA but it seems too complicated. I'd recommend you to start with JMF and look for other solution only if you really have problems.
..have tried JMF but the format compatibility I believe to be relatively poor when compared to other frameworks out there.
You are right about the lack of support for modern codecs, but it works just fine for older codecs. It might be a viable option if:
You control the format (as opposed to the user opening 'any old video' in it). Which you apparently do.
Bandwidth is not a huge problem. The more modern codecs improved compression markedly.
While the 'performance pack' version of the JMF which uses natives supports more formats, the core Java JMF API also provides some basic formats.

Tizen Mobile & IPad Linux - Does it allow GCC and Java?

https://www.tizen.org/ Tizen Mobile & IPad Linux very exciting.
Its allowing GCC. But does it run Dalvik JVM or OpenJDK?
Will then it will be compatible with 32-bit or 64-bit compilers?
Or we need to convert our source to be re-compiled using ARM compilers? of GCC?
Will it be easier to port C, Java code's now to Tizen? Where its complex and not natively available under Android phones/platforms?
As far as I know, it will be possible to package applications as DEB or RPM packages, you will be able to include an embedded VM (for example Avian VM) if you want, probably no JVM will be installed by default. JavaSE Embedded and OpenJDK should work (maybe with small modifications) under Tizen even though the documention only mentions C/C++ for native apps and HTML5/JavaScript for web apps. Moreover, there is no Java binding to its native APIs yet except those already available for Linux ARM and for APIs supported in any Linux distribution (for example JOGL 2.0). If you really need some help to use Java under Tizen, please contact the JogAmp Foundation here. Xerxes already succeeded in running JOGL 2.0 under Meego as you can see here, why not doing the same thing under Tizen?
N.B: Don't expect official Java support under Tizen.
If you check this two presentation from May:
Tips and Tricks: Designing Low-Power Native and Web Apps on page 3.
and this
Implementation of Standard Accessibility APIs for Tizen on page 9.
You see that basically Tizen will have two APIs and hence two types of applications:
Native;
Web(HTML5) pretty well documented already.
So no JVM or OpenJDK, don't know the Native API apps binaries will be compiled to but probably will know soon.
Since Tizen is pretty much in development you can check from time to time the official site.

frontend application in java

can we develop java frontend application just like we do in WPF? that runs on windows platform?
Of course, just use Swing or SWT.
of course you can use java also for frontend applications, those applications will require the java VM and will probably run in some platforms not only windows, this in general then depends on the details of your specific application.
Said so, I am not aware of libraries available in the Java world which would let you compose rich and advanced user interface like you can do with WPF.
Of course, Java can be used to create front-end applications that run not only on Windows, but on any operating system that has Java installed on it.
To create front-end GUIs, you could use either AWT(very old, not recommended), Swing or SWT(the latest addition to the Java GUI library by IBM).
XUI is an XML-based frontend development toolset for Java.
If you're looking for a ClickOnce equivalent, Java Web Start would be appropriate.
There are several GUI toolkits out there (as already mentioned by others), but they only provide the basic building blocks. (WPF also falls in this category, AFAIK.)
I recommend to build GUI application on top of a modular Rich Client Platform (RCP) such as the NetBeans Platform (Swing-based) or Eclipse RCP (SWT-based).
Here some links for the NetBeans Platform:
http://platform.netbeans.org/
http://netbeans.org/features/platform/features.html
http://netbeans.org/features/platform/all-docs.html
There´s a technology for desktop frontends from ADOBE called Adobe AIR.
It´s similar to WPF (it uses a variation of XML, in this case MXML), and has several rich components and effects!
Try it out at http://get.adobe.com/air/

Categories