Home > OS >  IntelliJ running a program with Gradle, "failed at task :Run" error
IntelliJ running a program with Gradle, "failed at task :Run" error

Time:03-11

Here is the error that I am getting whenever I try to run my program with Gradle. (I am on a linux ubuntu system, if that matters) I am using a JDK 11 version to run this.

Execution failed for task ':run'.
> Process 'command '/home/dex/Downloads/jdk-11.0.13/bin/java'' finished with non-zero exit value 1

Exception -

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':run'
Caused by: org.gradle.process.internal.ExecException: Process 'command '/home/dex/Downloads/jdk-11.0.13/bin/java'' finished with non-zero exit value 1

UPDATED (./gradlew run command)

> Configure project :
Project : => no module-info.java found

> Task :compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :run FAILED
Redirected Output: logs/master_log_3_9_2022_10_38_38.txt

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
5 actionable tasks: 3 executed, 2 up-to-date

From --debug(Only posted info that was in red)

2022-03-09T13:01:57.117-0500 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 4s


2022-03-09T13:01:57.116-0500 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.

2022-03-09T13:01:56.807-0500 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :run FAILED

2022-03-09T13:01:57.116-0500 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1

From log master file

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
    at Main.main(Main.java:210)
    at KioskApp.main(KioskApp.java:5)

CodePudding user response:

You have an array whose length is 0, and you want to access the first element of that array. Can you please copy paste your main function's array definitions? You can also find the problem by debugging your code.

  • Related