How to get the version number of JavaFX?
You can get the javafx.runtime.version
number from a System Property.
import javafx.application.Application;import javafx.stage.Stage;public class ReportVersion extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { System.out.println("javafx.runtime.version: " + System.getProperties().get("javafx.runtime.version")); System.exit(0); }}
Note that the System Property access method may cause a security exception if an unsigned application is embedded in a browser or accessed via WebStart, so Sergey's com.sun
call may be better even though all com.sun
calls are deprecated and not part of the official JavaFX public API.
Update
@assylias comments on Sergey's answer would seem to indicate that Sergey's com.sun
may cause a security exception if an unsigned application is embedded in a browser or accessed via WebStart. So perhaps there is no good solution to determining the javafx runtime version when running under those specific conditions.