'Finished with non-zero exit value 255

I'm using gradle to work with Stanford Phrasal. When I use the command gradle run it fails with giving following error.

FAILED

FAILURE: Build failed with an exception.

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

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

BUILD FAILED

UPDATE

When I tried gradle run --stacktrace I got following,

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':run'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)

    ... 58 more


Solution 1:[1]

The run task is added by the application plugin. It is of type JavaExec and just runs the class defined by mainClassName in build.gradle; which in your case is edu.stanford.nlp.mt.Phrasal

Now as @Bohemian said, your stack trace doesn't tell you much because all it is saying is that the java process returned -1 which could have happened from one of several code lines that exit with -1 in Phrasal.

adding --debug or --info to gradle commands aren't helping because they just change the log level of the gradle process, and not the separate java process being started by the JavaExec(run) task.

The simplest way to debug I reckon is run the distZip task, which creates a zip file of an executable jar and all required dependencies, unzip it, and run the jar with java -jar from the commandline. This should throw more helpful error messages about where the failure is occurring and you can go about fixing it from there.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RaGe