To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at

If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

Get to Know the PVS-Studio Static Analy…

Get to Know the PVS-Studio Static Analyzer for Java

Aug 02 2019

Over the years, the PVS-Studio team has been developing the same-name static analyzer. At this point the analyzer represents a complex software solution, which provides the analysis of such programming languages, as C, C++, C# and Java on Windows, Linux and macOS platforms. Just recently the Java language joined the ranks of supported languages. The PVS-Studio analyzer has proved itself as a reliable tool among C++ and C# developers in quite some time, whereas for Java audience PVS-Studio is still a newcomer. Many haven't even heard of the analyzer, and those who had, aren't quite familiar with all its abilities. So in this article, I'd like to introduce PVS-Studio Java to you, talk about the ways to start it and its abilities.



The PVS-Studio Java static code analyzer consists of 2 main parts: the kernel, which performs the analysis, and plugins for integration in build systems (Gradle, Maven) and IDE (IntelliJ IDEA).

Plugins get project structure (a collection of source files and classpath), then pass this information to the analyzer core. In addition, plugins are responsible for deploying the core for analysis - it will be automatically loaded at the first run.

It's also possible to run the analyzer directly, listing the sources and classpath.

Analysis can be done if your computer meets the following system requirements:

Operating system: Windows, Linux, macOS;

Minimum required Java version to run the analyzer with: Java 8 (64-bit). Note: A project being analyzed could use any Java version;

Minimum version of IntelliJ IDEA: 2017.2.

Plugin for Maven

If the project you're working on is based on the Maven build system, you can use the plugin pvsstudio-maven-plugin. To do this, you need to add the following to the pom.xml file:



Before running the analysis you need to enter the license data:

mvn pvsstudio:pvsCredentials "-Dpvsstudio.username=USR" "-Dpvsstudio.serial=KEY"

After that, the license information will be saved in %APPDATA%/PVS-Studio-Java/PVS-Studio.lic on Windows or in ~/.config/PVS-Studio-Java/PVS-Studio.lic on macOS and Linux.

After that you can run the analysis:

$ mvn pvsstudio:pvsAnalyze

In the block <analyzer> you can configure the analyzer. A list of all the settings can be found here.

Plugin for Gradle

If the project you're working on is based on the Gradle build system, you can use the plugin pvsstudio-gradle-plugin. To do this, you need to add the following in the build.gradle file:

buildscript {
  repositories {
    maven {
      url uri('')
  dependencies {
    classpath group: 'com.pvsstudio',
              name: 'pvsstudio-gradle-plugin',
              version: '{VERSION_PVS_JAVA}'

apply plugin: com.pvsstudio.PvsStudioGradlePlugin
pvsstudio {
  outputType = 'text'
  outputFile = 'path/to/output.txt'

Before running the analysis you need to enter the license data:

./gradlew pvsCredentials "-Ppvsstudio.username=USR" "-Ppvsstudio.serial=KEY"

After that, the license information will be saved in % APPDATA%/PVS-Studio-Java/PVS-Studio.lic on Windows OS or in ~/.config/PVS-Studio-Java/PVS-Studio.lic on macOS and Linux.

After that you can run the analysis:

$ ./gradlew pvsAnalyze

In the block 'pvsstudio' you can configure the analyzer. A list of all settings can be found here.

Plugin for IntelliJ IDEA

The PVS-Studio Java analyzer can be also used as a plugin for IntelliJ IDEA. In this case, the parsing of the project structure is made by means of this IDE and the plugin provides a convenient graphic interface to work with the analyzer.

The PVS-Studio plugin for IDEA can be installed:

Once you installed the plugin, you need to enter the license data:

1) Analyze -> PVS-Studio -> Settings


2) Registration tab:


You can then run the analysis of the current project:



The PVS-Studio analyzer is meant for teams of developers and essentially represents a proprietary B2B product. To play around with all analyzer abilities, you can request a trial key.

If you are developing open projects, or for example, you are a student, then you can use one of the free licensing options of PVS-Studio.

False Positives Suppression

To fight against false positives, the analyzer provides a set of different mechanisms.

1. Using special comments in the code:

void f() {
    int x = 01000; //-V6061

2. Using the suppress file.

3. Using the @SuppressWarnings(....) annotations.

The analyzer is aware of annotations and might not issue warnings on the code that has already been marked. For example:

void f() {
    int x = 01000;


What we've just looked at is only a small part of what could be told. For example, it's also possible to integrate with SonarQube and much more. PVS-Studio Java is a new direction that is actively developing:

  • new functionality is added,
  • abilities are expanding,
  • diagnostic rules are added and improved,
  • and much more.

To fully explore the existing analyzer abilities and not to miss the emergence of new ones in future, follow the PVS-Studio blog.

Popular related articles
The Evil within the Comparison Functions

Date: May 19 2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…
PVS-Studio ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
The way static analyzers fight against false positives, and why they do it

Date: Mar 20 2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
Static analysis as part of the development process in Unreal Engine

Date: Jun 27 2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
The Last Line Effect

Date: May 31 2014

Author: Andrey Karpov

I have studied many errors caused by the use of the Copy-Paste method, and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have ne…
Appreciate Static Code Analysis!

Date: Oct 16 2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
The Ultimate Question of Programming, Refactoring, and Everything

Date: Apr 14 2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…

Comments (0)

Next comments
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →