目前已知 10.0版本可以用jdk17.0.2
2. jdk1.8直接运行,错误提示:Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/puppycrawl/tools/checkstyle/Main has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
下载jdk-17_linux-x64_bin.rpm安装
sudo rpm -ivh jdk-17_linux-x64_bin.rpm java -version
将jdk默认路径改为原来的java路径
sudo alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- 1 /usr/java/jdk1.8.0_131/jre/bin/java *+ 2 /usr/java/jdk-17.0.2/bin/java Enter to keep the current selection[+], or type selection number: 1 java -version
使用绝对路径执行java命令:
sudo /usr/java/jdk-17.0.2/bin/java -jar checkstyle-10.0-all.jar -c google_checks.xml /scan-dir/ -f xml -o /tmp/report-name.xml



