B4J Code Snippet Check version of java

Similar threads

B4A Code Snippet [B4X] HexToColor and ColorToHex
B4J Code Snippet Find user documents folder
B4J Code Snippet Windows, Mac or Linux?
B4J Code Snippet Data Folder
B4J Library Updates to internal libaries


Well-Known Member
Licensed User
As some methods/classes are not available in older versions of Java, I have started checking the version installed in my libraries. The code is simple to add to the initialisation routine of the library.
Public Sub Initialize
    Dim ver As String = GetSystemProperty("java.version","0.0")
    If ver.StartsWith("1.8") = False Then
        Log("Sorry ????? library requires Java 8")
    End If
    ... rest of initialisation ...
End Sub
Saves you having to answer questions as to why it doesn't work, when run on older versions.