How to get major, minor, rev and build version from Windows Registy Editory using java code

305 views Asked by At

Using Registry key factor I am able to find the major, minor and rev version, but I need the build version from the Registry Editor. For instance, I'd like to get the "3" in the sequence "4.5.5.3". I am using the code below to get the major, minor and rev version.

major = new Integer(rKey.getIntValue(VersionMajor));

minor = new Integer(rKey.getIntValue(VersionMinor));

rev = new Integer(rKey.getIntValue(VersionRev));

Please help me to find the Build(subversion) version in the same way as mentioned above.

1

There are 1 answers

4
JosefZ On

If I can understand your question, I dare say you are seeking for something similar to next code snippet (not sure about right Java syntax)

String DisplayVersion =  "4.5.5.3";
String[] strArray = DisplayVersion.split(“\\.”);
for (String str : strArray) {
  System.out.println(str);
}