B4J Code Snippet Check version of java

Discussion in 'B4J Code Snippets' started by Daestrum, May 17, 2015.

  1. Daestrum

    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.
    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.
    jmon and Erel like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice