JIndent is easy to use, but I think it uses 4 spaces where suppose to be 8 spaces. Am I right or wrong? Jalopy??? Please, if someone use it before, tell me (us) how to work with it... CheckStyle??? Please, if someone use it before, tell me (us) how to work with it... Any other tools??? Why don't put those tools in FAQ for mark??? Regards...
Originally posted by Qusay Jaafar: CheckStyle??? Please, if someone use it before, tell me (us) how to work with it... Regards...
CheckStyle is fairly simple to use. To run it against all the files in a directory (recursively) java com.puppycrawl.tools.checkstyle.Main -r <dirname> This will use the default config file which follows Sun's standards. Read the documentation for more info. -BJ
posted 17 years ago
About check style, I used the following command: C:\checkstyle>java com.puppycrawl.tools.checkstyle.Main -r C:\temp MySourceCode.java but I got the following message: Exception in thread "main" java.lang.NoClassDefFoundError: com/puppycrawl/tools/checkstyle/Main then I supposed that is a class path problem. I wrote the following command: C:\checkstyle>java -classpath .;C:\checkstyle com.puppycrawl.tools.checkstyle.Main -r C:\temp MySourceCode.java but still same problem. Any Idea? Regards
to Qusay Jaafar , For Check Style, I create a batch file named checkstyle.bat under the %JAVA_HOME%\bin directory.
@echo off rem checkStyle.bat rem artu 2002-9-24 java -classpath F:\document\Java\checkstyle-src-2.4\lib\antlr.jar;F:\document\Java\checkstyle-src-2.4\lib\antlr-tools.jar;F:\document\Java\checkstyle-src-2.4\lib\jakarta-regexp-1.2.jar;F:\document\Java\checkstyle-src-2.4\lib\junit.jar;F:\document\Java\checkstyle-src-2.4\target\checkstyle com.puppycrawl.tools.checkstyle.Main %1 %2 %3 %4 %5 @echo on
Then, I can use the following DOS command to check a single file: D:\>checkstyle F:\temp\Test.java Or the following DOS command to check a directory: D:\>checkstyle -r F:\temp
Hope this helps.
David,<br />SCJP - 94% (2002-7-6)
posted 17 years ago
Here is the final result: using checkstyle: ----------------- 1. set the classpath for checkstyle-all-3.0.jar 2. type: java com.puppy.tools.checkstyle.Main -c docs/sun_checks.xml -r c:\myJavaClasses\MySourceCode.java This will work, but if you set the class path as: java -classpath .;c:\(your directory) com.puppy.(the other stuff like above), this will not work. You need to set the classpath into Environmental variables of your system. Why? (I don't know)... using JIndent -------------- 1. type: java -jar Jindent.jar MySourceCode.java This will re-arrange the source code according to sun code convention. Again, but, if you test the re-arranged source code with checkstyle, there are some differences. INTERSTING THING, isn't it? Regards