Vscode what version of java is running

When I started trying to program for the pi on Windows, java -version gave me version 11. (vscode for 2020 wpi stuff was installed). Now in the command shell I get java -version of 1.8. (I had started up an old version of eclipse to see what I had done before). How can I tell in vscode which java version is going to be used?

How can I point eclipse to use 1.11 that must have been installed for me to program this year’s robot? Where is java 1.11 installed?

All because, I don’t know gradle. Vision code .classpath doesn’t exist in any of the example projects. And a simple Matrix opencv example can’t find opencv.core.Core classes from code created from vscode on the PC. Setting the CLASSPATH and -D options in Java no longer work. I’m assuming that the class file output from vscode contains information on what java dependencies are being used and I don’t know how to override that nor create a java project in vscode on the PC that actually runs on the pi.

WPILib (well, the windows installer at least) ships with Java 11. The VSCode plugin that interacts with the GradleRIO gradle plugin, provides a command (Ctrl+Shift+P) to set the java version (essentially, add a vscode configuration to point to C:\Users\Public\wpilib\2020\jdk (I think that’s the path… something very close to that at least). This is the version you should be using everywhere. To set it as the default java version for your host machine (command shell included), just set your system PATH and JAVA_HOME environment variables to include the wpilib jdk path instead of the system installed jdk (java 8)

Thank you. While researching I found references in my path to wpilib 2019 stuff, and three ways to get to java 1.8 from a local path, a global path, and Oracle’s redirection. Found java 1.11 in c:\Users\Me\wpilib\2020\jdk\bin. Also in c:\users\public.

Also found that for the local path I needed to log out and back in, or restart to have it take affect.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.