How I solved java.lang.UnsupportedClassVersionError
I was trying out HSQLDB to run SQL scripts with ANT last night when I encountered java.lang.UnsupportedClassVersionError. Never encountered this in 3 years of coding. Recently, I tried to play safe and installed several JDK (and JRE) versions, and so it happened.
Quick diagnostics:
- Run java -version from commandline, you should be able to see the JRE that is in your %PATH% environment variable
- Run echo %JAVA_HOME%, this is what ANT would use if you try to run ant -diagnostics from the commandline, an entry like java.home : C:\Program Files\Java\jdk1.5.0_18\jre should be there so make sure JAVA_HOME also points to an updated JRE