I can use System.getProperty( "java.version" ) to find and display the JRE under which my program is running, but is there a straightforward way [I am a java newbie] to find the JDK version of 'javac' that was used to compile my .java file ? I am using Sun java exclusively.
No, that's not possible. What is possible, however is to find out for which version of Java the code was compiled; in other words, which JRE version is needed to run it. Frequently that's sufficient information.
If it is in your case, have a look at the bytes 6 and 7 (counting from 0) in the class file. They encode the targeted JRE version. See the table in this Wikipedia entry for details of what the numbers mean.
You can change the targeted JRE version during compilation by using javac's "-source" and "-target" switches.
Ping & DNS - updated with new look and Ping home screen widget