Linux虚拟机报Exception in thread “main“ java.lang.UnsupportedClassVersionError异常
今天在IDEA上打包成jar包部署到服务器上时,遇到了一个报错,写个博客记录一下具体如下:Exception in thread "main" java.lang.UnsupportedClassVersionError: com/atguigu/mr/wordcount/WcDriver has been compiled by a more recent version of the Java
·
今天在IDEA上打包成jar包部署到服务器上时,遇到了一个报错,写个博客记录一下
具体如下:Exception in thread "main" java.lang.UnsupportedClassVersionError: com/atguigu/mr/wordcount/WcDriver has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
解决方案:我的是服务器上的jdk版本与Windows的jdk版本不一致,Windows上的JDK版本更高。解决方法:在maven下的pom.XML配置Linux中的JDK版本就解决了。仅供参考
代码如下
<!--JDK配置 --> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> <spring.version>4.0.0.RELEASE</spring.version> </properties>
更多推荐
已为社区贡献1条内容
所有评论(0)