Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Does Not Exist Error; Project builds and Runs OK. #3832

Open
Arebusf21 opened this issue Oct 27, 2024 · 6 comments
Open

Package Does Not Exist Error; Project builds and Runs OK. #3832

Arebusf21 opened this issue Oct 27, 2024 · 6 comments

Comments

@Arebusf21
Copy link

Building a simple HelloWorld app to test importing an external .JAR file
The Jar was built with an earlier version of the JDK but builds on the command line without issues.
The linter indicates that the import class "Media" does not exist even though the jar file has been referenced.
The App runs OK without any errors. Where are these errors being reported from? It looks as it's a Red Hat response.

Environment
  • Operating System: Windows 10
  • JDK version: 17.0.13
  • Visual Studio Code version: 1.94.2
  • Java extension version: 1.35.1 (Language Support for Java by Red Hat.
Steps To Reproduce

Just load the folder containing the HelloWorld.java file into VSCode and the errors show up straight away.
Run the app with or without the debugger and it runs ok.

Source, (java file):
HelloWorld.txt

Log.pdf

settings:
settings.json

Current Result

indicates that package does not exist event though it builds ok.

Expected Result

no linting errors.

Additional Information

let me know what else I can provide

@snjeza
Copy link
Contributor

snjeza commented Oct 27, 2024

@Arebusf21 Could you try to copy your jars to the <your_project>/lib directory?

@Arebusf21
Copy link
Author

Hi: I created a new .jar file, with 2 new class files. I wanted to test creating a jar file with this version of java.
I have put the jar file into the /lib folder and I still get the "package does not exit" message. Once again the
test class builds and runs, it's frustrating, I cannot figure it out. There is a miss-match somewhere. I can see the package in the project explorer and intelisense is showing me the classes in my package, as I'm typing out the import statement.

@snjeza
Copy link
Contributor

snjeza commented Oct 28, 2024

@Arebusf21 Could you attach your project's folder?

@Arebusf21
Copy link
Author

@Arebusf21
Copy link
Author

Update:
So I had the Java Platform Extension for Visual Studio Code from Oracle installed. I disabled it.
and Voila! everything seems to be working fine now, no more bogus linting messages.
Would be nice to know why though.

@iwangbowen
Copy link

Update: So I had the Java Platform Extension for Visual Studio Code from Oracle installed. I disabled it. and Voila! everything seems to be working fine now, no more bogus linting messages. Would be nice to know why though.

Don't use Java extension from Oracle. It's not compatible with the extension from Red Hat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants