B4J Question Check if JavaFX is installed

Blueforcer

Well-Known Member
Licensed User
Longtime User
is it poosible to check if javaFX is installed?
I have a class wich seems to need JavaFX, but many users doesnt run JavaFX on their systems, so i need to stop loading this class

thanks
 

GMan

Well-Known Member
Licensed User
Longtime User
With this code
B4X:
Sub getSystemProperties
    ' Declare the JavaObject and init the class
    Dim JO As JavaObject
    JO.InitializeStatic("java.lang.System")
    ' Get the system properties into one object
    Dim objProperties As Object = JO.RunMethod("getProperties", Null)
    ' Convert the properties object into a list of strings
    Dim s As String = objProperties
    s.SubString(1)
    Dim l As List
    l = Regex.Split(", ", s)
    l.Sort(True)
    ' List the properties
    For i = 0 To l.Size - 1
        Log(l.Get(i))
    Next
End Sub
i read out some system Properties, also the actual JavaVersion.
Maybe you can use this to check if and if yes, what version i installed

Here is the line from the Log:
javafx.runtime.version=8.0.66-b33
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Or maybe (just a tad shorter)
B4X:
 Log(GetSystemProperty("java.version",""))
 Log(GetSystemProperty("javafx.runtime.version","no javafx found"))
 
Upvote 0
Top