1

I followed the (excellent) tutorial on deploying a Java FX app at:

http://code.makery.ch/library/javafx-8-tutorial/part7/

The tutorial creates a build.fxbuild file, where I populate an application version number field. As far as I understand this file is used by e(fx)clipse to generate a file that will be used by the Ant build tool.

I would like to retrieve this value programatically so I may know what version of my app I am currently running.

Is it possible?

mils
  • 1,878
  • 2
  • 21
  • 42

1 Answers1

1

I solved it myself. As this question points out

What is a good way to handle a version number in a Java application?

the following code will retrieve the version:

Package p = getClass().getPackage();
String version = p.getImplementationVersion();

However, it also points out:

Make sure you're not running from the IDE. There has to be a jar in order for it to find the manifest entries

And on top of that you have to make sure that when you change the verison number in build.fxbuild file that you generate a new ant build.xml, then run an Ant build, and then you will see the new version number.

Cheers,

mils
  • 1,878
  • 2
  • 21
  • 42