#553 Problem in invocation of Checkstyle from Command Line

release_5.0
closed
Oliver Burn
7
2012-10-10
2009-04-15
Nitin Bhardwaj
No

Hi Friends,
The version of S/W used: Checkstyle 5.0 beta 2, JDK 1.4, Ant 1.7.1 OS: Windows XP
I included checkstyle-5.0-beta2.jar in the classpath. I've added C:\j2sdk1.4.2_04\lib;C:\j2sdk1.4.2_04\bin in the classpath and C:\j2sdk1.4.2_04;C:\j2sdk1.4.2_04\jre\bin in the PATH Environment system variables.
I then tried to invoke Checkstyle using the Command Line on a simple .java file(Check.java). However, I got java.lang.UnsupportedClassVersionError. The following is the snapshot of my Command Prompt(I've Checkstyle in the folder--C:\nitCheckStyle\checkstyle-5.0-beta2):

C:\nitCheckStyle\checkstyle-5.0-beta2>java com.puppycrawl.tools.checkstyle.Main -c sun_checks.xml \ -f xml -o checkstyle_errors.xml Check.java

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/puppycrawl/tools/checkstyle/Main (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

C:\nitCheckStyle\checkstyle-5.0-beta2>java -jar checkstyle-all-5.0-beta2.jar \ -c C:/nitCheckStyle/checkstyle-5.0-beta2/sun_checks.xml \ -f xml -o C:/nitCheckStyle/StyleTest/CheckstyleBuild/build/checkstyle_errors.xml Check.java
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/puppycrawl/tools/checkstyle/Main (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Discussion

  • Oliver Burn
    Oliver Burn
    2009-04-15

    Checkstyle 5.0 required Java 5 as a minimum. It will not run with JDK 1.4