记一次java报错:Exception in thread "main" java.lang.UnsupportedClassVersionError
代码
class Demo1{ public static void main(String[] args){ int a=5; int b=3; //加减乘除、求余 //plus System.out.printf("%d\n",a+b); //minus System.out.printf("%d\n",a-b); //multiply System.out.printf("%d\n",a*b); //divide System.out.printf("%d\n",a/b); //mod System.out.printf("%d\n",a%b); } }
报错Exception in thread "main" java.lang.UnsupportedClassVersionError: Demo1 : Unsupported major.minor version 52.0
原因:编译时的java版本跟运行时的版本不一致
分析:
配置了classpath
解决:删除classpath