No, you cannot catch that exception, because it's thrown when the class is loaded and before your code is executed.
You can use the "-source" and "-target" switches on the
Java compiler to compile a class to an older version. That way, you can make a class that checks the Java version:
Compile this with:
javac -source 1.2 -target 1.2 TestJavaVersion.java By using the switches, the Java compiler will create a class file that's compatible with Java 1.2 or newer.
(Note that the -source and -target switches are not a magic way to make your program run on any old Java version; if you use new language features or API classes that are not in the old version, it won't compile or run properly on the old version.)