allwpilib icon indicating copy to clipboard operation
allwpilib copied to clipboard

The system cannot find the path specified // Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

Open IdlePhoenix1645 opened this issue 2 years ago • 16 comments

Describe the question you have. How do I fix a certain message I get when building my java project Describe the reason for your confusion. I keep getting an error message when building my java project and I don't know how to fix it.

Is your question related to a problem? Please describe. Yes, I keep getting A specific set of error messages when I build my java project Additional context The terminal returns the following output below when I try to build my project

The system cannot find the path specified Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain The terminal process "cmd.exe /d /c gradlew build -Dorg.gradle.java.home="c:users\public\wpilib\2022\jdk"" terminated with exit code 1.

IdlePhoenix1645 avatar Apr 24 '22 17:04 IdlePhoenix1645

Have you verified you are in the correct project directory? It is likely that essential gradle files are missing. Can you create a new project and reproduce this?

Daltz333 avatar Apr 24 '22 17:04 Daltz333

I tried to simulate the examples and they started up just fine, but my project won't start the simulation

IdlePhoenix1645 avatar Apr 24 '22 17:04 IdlePhoenix1645

I created a new project and it builds fine? I don't know what I did to make my initial project fail to build

IdlePhoenix1645 avatar Apr 24 '22 17:04 IdlePhoenix1645

I would recommend just copying your code over to the new project.

Daltz333 avatar Apr 24 '22 19:04 Daltz333

I will do that, I am just trying to figure out why it happened

IdlePhoenix1645 avatar Apr 24 '22 19:04 IdlePhoenix1645

Did you happen to push your code to git? That error is caused by the jar in gradle/wrapper missing. We’ve seen cases where teams remove that file from the .gitignore, and then builds afterwards fail with that error.

ThadHouse avatar Apr 24 '22 19:04 ThadHouse

No, I have seen people talk about that. I haven't used git for my projects. I have also seen people talk about OneDrive causing issues, but I do not have OneDrive set up on this computer

IdlePhoenix1645 avatar Apr 24 '22 19:04 IdlePhoenix1645

Some extremely aggressive anti-viruses could possibly remove it too.

Daltz333 avatar Apr 24 '22 19:04 Daltz333

Would Windows defender be considered extremely aggressive? I've found that it likes to yell at me about trusting folders when I make new projects.

IdlePhoenix1645 avatar Apr 24 '22 19:04 IdlePhoenix1645

I would not think it would be Windows defender (many of us on the development team have it on default). Have you moved the project files around at all in the past?

Daltz333 avatar Apr 24 '22 19:04 Daltz333

I moved the entire project folder to desktop, but I never moved a Folder/file around inside the project folder

IdlePhoenix1645 avatar Apr 24 '22 19:04 IdlePhoenix1645

Just a conjecture, but it's possible that the move only partially moved the folder. A folder move is simply a collection of individual file moves.

Daltz333 avatar Apr 24 '22 19:04 Daltz333

That is odd but it does make sense

IdlePhoenix1645 avatar Apr 24 '22 19:04 IdlePhoenix1645

I copied my code over into a new project and now I am receiving the error messages again @Daltz333

IdlePhoenix1645 avatar Apr 24 '22 20:04 IdlePhoenix1645

Are you still dealing with this issue? @IdlePhoenix1645

prateekma avatar Jul 27 '22 04:07 prateekma

I haven't had access to my coding laptop for months, I cannot confirm or deny if the issue is still there at this moment.

IdlePhoenix1645 avatar Jul 27 '22 11:07 IdlePhoenix1645

Can this be closed?

Starlight220 avatar Jan 22 '23 19:01 Starlight220