Skip to content

Question- awt and swing not recognized #1532

Closed as not planned
Closed as not planned

Description

i have a maven project in vs code, but when i try to import java.awt or java.swing, it says package does not exist

Activity

  1. github-actions commented on Nov 9, 2025

    @github-actions

    Hi carolina (@the-bat-harpy), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    Suggestions to resolve “package java.awt/swing does not exist” in VS Code with Maven:

    • Verify you’re using a full JDK (not just a JRE)
      • Run Java: Configure Java Runtime in VS Code’s Command Palette and confirm java.home points to a JDK (≥1.8) that includes the java.desktop module
      • Ensure your JAVA_HOME/ JDK_HOME environment variables and VS Code java.home setting reference that JDK
    • Re-import and rebuild your Maven project
      • In the Maven explorer or via the Command Palette, run Maven: Update Project / Reload All Maven Projects
      • Add or verify in your pom.xml the maven-compiler-plugin is set to source/target 1.8+ if needed
    • Clean and restart the Java language server
      • Run Java: Clean the Java Language Server Workspace then reload the window
    • If you have a module-info.java, add:
      requires java.desktop;
      

    High-confidence related issue:

    Other references with low confidence

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

  2. chagong commented on May 27, 2026

    @chagong
    Contributor

    carolina (@the-bat-harpy) can you check if "extension pack for java" is properly installed and you can see "Java: Ready" at the bottom vscode status bar?

  3. github-actions commented on Jun 11, 2026

    @github-actions

    This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions