B4J Code Snippet Check version of java

Similar threads

B4A Code Snippet [B4X] HexToColor and ColorToHex
B4J Code Snippet Find user documents folder
B4A Library [B4X] [XUI] Cross platform & native UI library
B4J Code Snippet Windows, Mac or Linux?
B4J Code Snippet Data Folder

Daestrum

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.
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