0

When I run my program, the following code returns a null

ConsoleApp.class.getPackage().getImplementationVersion()

However, when I copy the JAR file to another folder outside my project's folder and execute it on the console, it returns the version number of my program correctly. I'm assuming my program has no access to the MANIFEST file during runtime. Still, I haven't found a satisfactory answer to this behaviour. Why is this happening? What's happening behind the scenes?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
armel
  • 299
  • 3
  • 14
  • 1
    Likely your IDE is running the unpackaged classes directly from the build directory, and not from a packaged JAR. – Mark Rotteveel Apr 26 '21 at 07:43
  • Is this normal behaviour? Are there any standards as to whether an IDE should use the build directory or the jar file? – armel Apr 26 '21 at 09:25

0 Answers0