Reputation: 557
I am trying to execute this example shown here
http://pmd.sourceforge.net/pmd-5.3.0/customizing/howtowritearule.html
WhileLoopsMustUseBracesRule class not found is shown [one of the standard issue for beginners i believe]
Method tried :
1) cd pmd-5.3.0
2) created WhileLoopsMustUseBracesRule.java and ruleset.xml as per shown in the page.
3) javac -cp [all the required jar files seperated by ; since it is windows pc ] WhileLoopsMustUseBracesRule.java
4) bin/pmd.bat -d [code on which pmd has to check the rule] -f xml -R ruleset.xml
the above steps are giving me no class found error,here developer has commented saying these steps work [ http://sourceforge.net/p/pmd/discussion/188192/thread/7a34d224/ ]
Please let me know if i am missing anything.
I tried adding class file directly to classpath as well Other methods tried :
1) compiled the WhileLoopsMustUseBracesRule.java file and got the .class file.
2) created a jar using jar -cf jar_name jar_file command
3) added that jar file in the class path , using set CLASSPATH and also tried adding directly in the batch file used to run PMD i.e. pmd.bat
please help !
Upvotes: 2
Views: 518
Reputation: 557
I found the solution!
Had to set CLASSPATH separately using
set CLASSPATH=path\to\my\classfile
and then in the batch i had to add %CLASSPATH% , otherwise using -cp was resetting the classpath i guess. This worked for me.
Thanks
Upvotes: 2