Is there a Java equivalent of .NET's System.Version class? How do I say this in Java?
Version myVersion = new Version(2, 1);
Is there a Java equivalent of .NET's System.Version class? How do I say this in Java?
Version myVersion = new Version(2, 1);
Here's a class from OSGi: http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Version.html
And the corresponding source: http://www.docjar.com/html/api/org/osgi/framework/Version.java.html
To get a system/modules version e.g. String.class.getPackage().getImplementationVersion()
If you want to specify your own version, create a Manifest.txt file to be added to your jar-file as in this tutorial
See also the javadoc for Package
When you're using the Spring framework, you can use org.springframework.data.util.Version
. It has a constructor which exactly fits your piece of code:
Version myVersion = new Version(2, 1);
© 2022 - 2024 — McMap. All rights reserved.