-
Notifications
You must be signed in to change notification settings - Fork 443
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
Visual Code and jar files #501
Comments
The Eclipse backend providing java support in vscode-java doesn't have access to customized libraries added to the JDK. Here's a Maven-based project to help you started. The pom.xml, or project descriptor, is pretty self-explanatory (and a bit verbose). You'll find:
|
eclipse-jdtls/eclipse.jdt.ls#927 should help, by just adding jar files in a lib/ folder at the root of the directory. |
Woo! Unbelievable! |
I searched in a lot of places for how to import .jar files in VSCode, and did not have much success. It seems VSCode prefers to use a project build file (Maven, Gradle) to read dependencies. However, there's a new feature where you put .jar files in a lib folder and it works. redhat-developer/vscode-java#384 microsoft/vscode-java-debug#194 redhat-developer/vscode-java#501 eclipse-jdtls/eclipse.jdt.ls#927
Hello all,
I'm pretty sure this is a silly question but this is driving me crazy as I don't know what to do to work it out. I am not a Java expert although I have some programming skills. I'm trying to use Visual Code + Java Extension Pack as I thought it could be a good combination.
I am not using any project (eclipse, maven, etc) as I'm only creating short and straightforward programs. The problem I'm facing is when I try to use some classes from a jar file (for instance, algs4.jar from https://algs4.cs.princeton.edu/code/algs4.jar)
I create a simple java file in a directory that uses some of the classes with an import directive and I've added the directory where algs4.jar resides to my classpath (operating system) variable. From the command line, I can run successfully javac and java command, so everything looks fine (no errors, no warning, etc). I can compile and run my program. But when I try to run my java file from Visual Code, I receive the following error:
It clearly shows that Visual Code can't find the jar file but I don't know what to do to teach VC where that file resides.
Would kindly someone help me to work this problem out? By the way, where can I find more information about the usage of VC + Java?
Thank you very much.
Environment
Additional information
These are my import lines
The text was updated successfully, but these errors were encountered: