今天第一次执行java.exe时出现了error,经过查询发现是因为java版本和javac版本不一致。
参考
错误代码
1 | Exception in thread "main" java.lang.UnsupportedClassVersionError: helloworld has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0 |
解决方案
这个问题主要是因为java和javac的版本不一致导致的,需要删除旧版的java就可以
可以进入官网下载删除工具,将旧版java删除之后在DOS命令行使用java -version和javac -version查看版本,如果相同就解决了。
Author:oCodeHoney
Date:2020-5-27