有些時候,我們會遇到版本不匹配的問題。如: bad class file: /usr/java/jdk1.5.0_06/jre/lib/rt.jar(java/lang/Object.class)class file has wrong version 49.0, should be 48.0Please remove or make sure it appears in the correct subdirectory of the classpath.這是因為編譯環(huán)境和運行環(huán)境的不一致造成的,比如tomcat5.5和jdk1.5配合的時候,可能就會出現(xiàn)。解決這個問題的方法:copy jdk1.5的lib/tools.jar到tomcat5.5的common/lib/tools.jar,覆蓋掉原有文件就可以了。
Unsupported major.minor version 49.0
電腦中裝了很多JDK的版本,Eclipse中也分別有JDK1.4,JRE1.5,JRE1.6的Project,不同的項目需要經(jīng)常切換JDK版本,執(zhí)行某工程的時候突然出現(xiàn)“Unsupported major.minor version 49.0”的錯誤。
出現(xiàn)這樣錯誤的原因是JDK1.5下編譯的東西被放到了JDK1.4下執(zhí)行。
Eclipse中修改方法:
「Window」->「Preferences」->「Java」->「Compiler」->「JDK Compliance level」->「1.4」改成1.4就OK了。
錯誤:class file has wrong version 49.0, should be 48.0也有可能是這個原因,我就活活被整了三天!
錯誤提示:The type ThreadLocal is not generic; it cannot be parameterized with arguments <Session>
另外每個項目下的“JRE System Library[jdk1.4.2]"如果你看到這個JDK版本跟你不配,那么你就需要在類庫右擊:configure->edit library更改你的JRE了,因為JDK1。5以上有的新東東,1.4.5沒有,所以就報這個錯啦。