Skip to content

java: cannot find symbol symbol: class Generated location: package javax.annotation #4166

@Nyagar-Abraham

Description

@Nyagar-Abraham

The error "java: cannot find symbol symbol: class Generated location: package javax.annotation" indicates that the Java compiler cannot locate the Generated class within the javax.annotation package. This typically occurs in projects that use code generation or annotations and are missing a required dependency or have an incorrect project setup.

Here are the common causes and solutions:
Missing javax.annotation-api dependency.
The Generated annotation is part of the javax.annotation-api library. If your project uses a build system like Maven or Gradle, you need to explicitly add this dependency.

Maven

<dependency>
       <groupId>javax.annotation</groupId>
       <artifactId>javax.annotation-api</artifactId>
       <version>1.3.2</version> <!-- Or the appropriate version for your project -->
   </dependency>

Gradle

 dependencies {
       implementation 'javax.annotation:javax.annotation-api:1.3.2' // Or the appropriate version
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions