Get version of a Java package (in Java)

It’s easy!

String version = myObject.getClass()
                         .getPackage()
                         .getImplementationVersion();

Where it comes from…? I think from the MANIFESTO in the jar file.

This entry was posted in Programming and tagged , by swk. Bookmark the permalink.

About swk

I am a computational linguist, teacher of computer science and above all a huge fan of LaTeX. I use LaTeX for everything, including things you never wanted to do with LaTeX. My latest love is lilypond, aka LaTeX for music. I'll post at irregular intervals about cool stuff, stupid hacks and annoying settings I want to remember for the future.