I want to write a sample Java file in which I want to know the JVM version in which the class is running. Is there a way?
System.getProperty("java.version") returns what you need.
System.getProperty("java.version")
You can also use JMX if you want:
ManagementFactory.getRuntimeMXBean().getVmVersion()
1.4m articles
1.4m replys
5 comments
57.0k users