Good Evening,
I have been trying to build my robot code and deploy it. It has no errors and is able to be built on another computer. When I go to the computer that I have written all the code on it states it gives the exit code 2 and goes no further.
Upon further investigation, the other line of output is related to the gradle wrapper: gradlew. When I try to run this line myself, it cannot be found. I have placed a screenshot of the output in this thread:
I also have typed this command in the prompt, and it builds fine:
I must admit, in all my years of doing this, I am lost. Anyone with any insight into getting this to work? Thank you.
FYI - This is a Command Based Java Project, but I think that matters not.
What folder do you have open in vscode? The folder with build.gradle and gradlew.bat needs to be the root folder open in vscode. If it’s in a subfolder, it will not work.
It is located in the root folder.
If I am directly typing the correct command into the terminal, it will do it. But it will not do it if I do it through the command pallet. Odd, why would it do that?
Oh, you’re getting error code 2 on the wpilib build. Usually when we see that, it’s caused by a bad java install. For your test, try running from cmd, not powershell. And run exactly the command you see from vscode, no space between the D and org.
That will be the exact scenario. Usually the failure 2 is a general java failure, and rerunning the installer fixes it.
Bad news here though, I have reinstalled after deleting the public folder many times. Do I just need to reinstall a certain part?
I have been getting a lot of workspace crashes too. It would work for 5 minutes then not.
Try running ./gradlew --stop
to stop all daemons. Then go in and delete the jdk folder. Once that’s done, you don’t have to rerun the installer, you can actually just open it as a zip file (with like 7zip), go into the inner files.zip archive, and extract the jdk folder in there to replace the one you deleted. I wonder if the installer is being a bit wonky.
Workspace crashes definitely point to a jdk issue.
Also, a bit more information on the system. What version of Windows, what bitness
It’s sounding like it could be a hardware issue like bad RAM. There are boot usb sticks (Memtest86+) that can be used to do an exhaustive memory check.
I have done exactly what was suggested. It still has the same problem.
Please note, I can still build, I just have to manually activate gradle manually through the command prompt. I just use the command .\gradlew deploy command and it works. It is VSCode that cannot do that.
Good morning,
I have completed a memory test and it passed.
I still do not get what is going on, very odd.
I don’t know if you are doing this on a schools internet. But i was about a week back running into the same issue. I jumped onto a private network (like a hotspot) and have had no issues since then. I found that schools firewalls blocked the background running process of Gradle because it wasn’t a trusted source.
Nope, not at a school, free internet.
I have a feeling it has something to do with the JDK, I think I want to reinstall with a re-downloaded version.