others-how to solve finished with non-zero exit value 143 when using gradle bootRun in SpringBoot apps

Problem

When we develop spring boot applications with gradle bootRun , sometimes, we got this problem:

Execution failed for task ':app2:bootRun'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java'' finished with non-zero exit value 143

Environment

  • gradle 6.x
  • spring boot 2.3
  • IntelliJ IDEA 2019.3

Reason

The gradle version used by IntelliJ IDEA is not the same as the spring boot project’s gradle version.

Solution

Step 1: Upgrade your gradle version

You can follow this article to upgrade your gradle version in your system.

Step 2: Set correct gradle in your IntelliJ IDEA gradle configuration

Open your IntelliJ IDEA , then follows these steps:

  1. Open preference menu
  2. Search ‘gradle’ in the preference page
  3. Make sure that the ‘Use Gradle From’ field points to the correct gradle version in your system.

image-20201120095802012