0

I have a Java application, running from a jar; I need to show version number in a classic "About..." box (telling "My Application, version 1.0.0", that's all).

Given that I save that string in a MANIFEST.MF file, how do I retrieve it at runtime?

I tried

swVersion = Main.class.getPackage().getImplementationVersion();

but it returns a null. In my jar, under /META-INF/MANIFEST.MF, I have a property like

Implementation-Version: 1.0.0

which is usually a working example, is it?

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
lmattcris
  • 49
  • 3
  • In the javadoc from Packige: **Implementation Note:** The builtin class loaders do not explicitly define Package objects for packages in _**named** modules_. Instead those packages are automatically defined and have no specification and implementation versioning information. – Joop Eggen Oct 13 '21 at 13:55
  • @MartinZeitler The thread is interesting, however note that the OP didn't receive a working answer, in the end. Still experienced the same issue, as in my case. Even the answer to run *outside* the IDE isn't working in my case as well, the result is still /null/ – lmattcris Oct 15 '21 at 08:23

0 Answers0