This guide provides step-by-step instructions to install PMD on Mac, Windows, and Linux for Java static analysis in 2025. PMD is a popular tool for detecting code issues and enforcing best practices.
brew install openjdk@17
(Mac) or sudo apt-get install openjdk-17-jdk
(Linux)unzip pmd-bin-*.zip
./pmd-bin-*/bin/run.sh pmd -d . -R rulesets/java/quickstart.xml -f text
tar -xf pmd-bin-*.zip
pmd-bin-*/bin/pmd.bat -d . -R rulesets/java/quickstart.xml -f text
PMD is easy to install and use on all major platforms. Use the steps above to enforce best practices in your Java code in 2025!