Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Java JDK is different in VSCode than in the terminal

I looked through a few questions similar to this but mine is too specific for them to help. For one of my classes at school, I need to run an extension to Java called Hadoop. I have fully configured my Hadoop and have it working in my terminal (which I am SSHed into) but the JDK of my VSCode (which is also connected via SSH) doesn’t recognize that Hadoop exists (likely because they are not looking at the same JDK).

I am getting hundreds of errors when trying to import things and define classes in my code but it can compile fine because the terminal recognized Hadoop. It’s mostly annoying because I want to see where the legitimate errors are.

Hadoop Errors

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Compilation working

I am still getting an error because I have not completed the assignment but at least Hadoop is recognized by the compiler.

Attempt to locate terminal JDK

In the above image, you can see that I tried to change the JDK path to one of the ones provided to me in the terminal but it says there’s nothing there. I have also tried to go the command to "Install New JDK" to see if it would let me use an existing one but it does not. This is all on SSH which is why I am having so much trouble. If I left anything out, please let me know and I will add it in.

Any help would be appreciated, thanks!

>Solution :

In VS code ,Seems like your Hadoop jars are not part of your class path ,hence vs code is not able to recognize the import .
If you are not using maven/Gradel you may have to import them manually as below

Please refer to this question on how to add external jars in vs code.

Visual Studio Code, Java Extension, how to add a JAR to classpath?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading