Skip to content

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

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
   }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions