B4J Code Snippet Check version of java

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.
B4X:
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")
        ExitApplication
    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.
 
Top