Can’t find @Nullable inside javax.annotation.*

Tags: , , , ,

I want use @Nullable annotation to eliminate NullPointerExceptions. I found some tutorials on the net, I noticed that this annotation comes from the package javax.annotation.Nullable; but when I import it a compilation error is generated: cannot find symbol


You need to include a jar that this class exists in. You can find it here

If using Maven, you can add the following dependency declaration:


and for Gradle:

dependencies {
  testImplementation ''

Source: stackoverflow