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

Linter reports "Package does not exist" error even though code compiles and runs. #317

Open
Arebusf21 opened this issue Oct 31, 2024 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@Arebusf21
Copy link

Arebusf21 commented Oct 31, 2024

Hi:
I get a "Package does not exist" error when compiling and running my App.
Even though the code compiles and runs ok, this is still an issue worth looking into as the extension is pretty useless
with your code littered with error messages!

It's a very simple app written to test the extension.
I still get the error even when I copy the library to the working folder.

I have noticed that the error messages are a result of background scanning of code by netBeans? nbjrt...

Environment:
Windows 10.
VSCode: 1.95.0
Oracle Java Extension: 23.0.0
I have set the run configuration environment variable: CLASSPATH to point to my .jar file. the compiler can find it ok.
settings.json file:
{
"jdk.project.jdkhome": "f:\program files\java\jdk-17",
"jdk.verbose": true,
"jdk.runConfig.env": "CLASSPATH=e:\dev\java\lib\*"
}

here is my source:
HelloWorld.zip

Error Messages reported by the Linter:
Messages.txt

@sid-srini
Copy link
Member

Hi @Arebusf21. Thank you for reaching out. I am sorry for the late response.

The main reason that the compiler does not find the library jar which contains the package referenced in the code is that jar files that are being added manually to the class-path should be named explicitly. In your example, this would mean explicitly writing ClassTest.jar when adding it to the --class-path option in Run Configuration > VM Options or the CLASSPATH Environment.

The * glob/wildcard character works on the command-line java utility in a shell or cmd prompt. In Java 8 and below, i.e. prior to JDK 10 (and some later versions of JDK 9), only the shell would expand the wildcards on the command-line. However, since then the java CLI tools do apply wildcard expansion internally, to improve the user experience. If you would like, we could mark this as an enhancement request to support wildcards in the class-path options manually supplied. I request your feedback on this.

Please let us know if you are able to continue with your work, in the current version of the extension, by specifying the jar file in the classpath in the Run Configurations. Thanks.

@sid-srini sid-srini added enhancement New feature or request question Further information is requested labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants