$java -version
prints like below
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
The info which I am interested in is complete java version, System.getProperties()
doesn't seem to have that information. It only has the version before _
, not update information which is 40
in my case.
EDIT: When I run the a test code System.out.println(System.getProperty("java.version");
prints the complete version. But I am working on a large codebase in which I can't get the same result. I checked the code-base if the property somehow overwritten at some point, but couldn't find anything.
EDIT_2: I figured out that java.version
prints 1.8.0_40 when I manually compile the code with javac
then run it with java
on the terminal. However it prints only 1.8.0 when I run it via IntelliJ.