Java VersionUtil-class And Method Code Example


Here is an example of how to use the VersionUtil class from the org.apache.commons.io package in Java:

import org.apache.commons.io.VersionUtil;

public class Main {
    public static void main(String[] args) {
        // Get the version of the commons-io library
        String version = VersionUtil.getVersion();
        System.out.println("Commons-IO version: " + version);
    }
}

In this example, we use the getVersion() method of the VersionUtil class to get the version of the commons-io library. The version is returned as a string and it is printed in the console.

It's worth noting that this class was removed from the apache.commons.io library in version 2.6 and later versions, You can use other libraries or maven dependencies to get the version of the library