這是我嘗試使用 Gradle 運行程式時遇到的錯誤。(如果這很重要,我在 linux ubuntu 系統上)我正在使用 JDK 11 版本來運行它。
Execution failed for task ':run'.
> Process 'command '/home/dex/Downloads/jdk-11.0.13/bin/java'' finished with non-zero exit value 1
例外 -
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
更新(./gradlew 運行命令)
> 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
來自--debug(僅發布的紅色資訊)
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
從日志主檔案
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)
uj5u.com熱心網友回復:
您有一個長度為 0 的陣列,并且您想要訪問該陣列的第一個元素。你能復制粘貼你的主函式的陣列定義嗎?您也可以通過除錯代碼來發現問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/440778.html
