0

I just started learning Spring Boot and I noticed that when I need to build Spring Boot project with Gradle in other terminal (I've tried this command in git bash and IntelliJIDEA's terminal) than command prompt, I have to type it like this: ./gradlew bootRun Instead of this: gradlew bootRun Which I type in command prompt.

Is it about path variable? (I do set path to Gradle)

(Spring Boot 3, Gradle 7.6)

I've tried searching for something like "./ in command prompt" and "spring boot gradle command prompt", but I couldn't find anything.

I wanted to understand why I need to use ./ in other terminals and not in command prompt.

  • In *nix based system, `./` specifies the directory to indicate you want to run the file in your local directory (as opposed to the system path). It can help prevent command spoofing, as you are giving an explicit path. In Windows Command Prompt, the same `gradlew` command runs the `gradlew.bat` file, and has never required the explicit path. However, I tend to use Powershell on Windows now for a terminal now and that does require the `./` before `./gradlew`. It's more of an operating system requirement than anything else. – User51 Jan 24 '23 at 20:34
  • @User51 no it has to do with the shell and not the OS. The searching path in cmd includes the current directory whereas PowerShell only searches in `$PATH` like most other shells for security reasons – phuclv Jan 25 '23 at 02:07

0 Answers0