I recently started using Visual Code because FRC had stopped supporting Eclipse.
Right off the bat, the code would not build, instead giving me this:
> Executing task: gradlew build -Dorg.gradle.java.home=“C:\Program Files\Java\jdk-11.0.2” <
The terminal process terminated with exit code: 2
So, following the advice of other forums and GitHub issues pages, I found that changing my java.home
path would be helpful.
It was set at default, yet now it is set as the JDK file in my program files in the C: directory.
I am at the end of my rope and am running out of options for getting Java to build on this computer, seeing as the JDK/JRE settings are all optimal and updated.
Any help would be amazing!
Did you use the offline installer? The installer puts a JDK into C:\Users\Public\frc2019 for you.
I changed the path to C:\Program Files\Java\jdk-11.0.2
after receiving the output above.
We’ve sometimes seen this issue with bad JDK installs. Can you try removing C:\Users\Public\frc2019 and re-running the WPILib offline installer?
I also ran into this issue and haven’t been able to fix it. You can still build, you just have to copy and paste the command gradlew build -Dorg.gradle.java.home=“C:\Program Files\Java\jdk-11.0.2” text
into the terminal (you will see a plus button in the top right of the terminal window). Also, expect the Java language support to crash a lot in vscode. By this I mean you might experience autocomplete no longer working and the wpilib libraries will stop being recognized. Restarting VScode usually fixes that issue.