添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't use CheckStyle at all (ver 6.9 nor 6.10); upon attempting to run it, I get an IllegalAccessError .

Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.commons.cli.Options.getOptionGroups()Ljava/util/Collection; from class org.apache.commons.cli.DefaultParser
    at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:109)
    at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:76)
    at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:60)
    at com.puppycrawl.tools.checkstyle.Main.parseCli(Main.java:140)
    at com.puppycrawl.tools.checkstyle.Main.main(Main.java:74)
          

my output on my files but with the same names as yours:

/var/tmp $ java -jar checkstyle-6.10-all.jar -c CS1332-checkstyle.xml MyClass.java
Starting audit...
/var/tmp/MyClass.java:3:45: '}' at column 45 should be on the same line.
/var/tmp/MyClass.java:11:5: '}' at column 5 should be on the same line.
/var/tmp/MyClass.java:19:5: '}' at column 5 should be on the same line.
/var/tmp/MyClass.java:20:1: '}' at column 1 should be on the same line.
Audit done.
Checkstyle ends with 4 errors.
          

This is happening on two machines that I've seen - one running OS X Yosemite (not sure of the point version) and another running OS X Mavericks (10.9.5). It works fine on my personal machine running Yosemite (10.10.5).

Here's my check XML.
https://cloudup.com/cyz2tYjV4ei

"-all" jar do have all dependencies inside of it. You can not use checkstyle-6.10.jar without all dependecies. Most likely all dependecies jars are in your system classpath that is why it works on some of your PC.

Here is some examples http://checkstyle.sourceforge.net/cmdline.html#Usage_by_Classpath_update