gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
91 stars 8 forks source link

Run with vmoptions: '-ea', error: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1 #1077

Open yihchu opened 3 years ago

yihchu commented 3 years ago

I need 'assert' in my code, so i set '-ea' to vmoptions, but it can not run, and give me the error: Run with vmoptions: '-ea', error: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

I tried java project and maven project, both of them works well, so i guess i must be something wrong with gradle. I have tried gradle-4.10,gradle-6.5 and gradle-6.6.1, all of them went wrong.

Expected Behavior

no error

Current Behavior

error: Run with vmoptions: '-ea', error: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

Context

Just new a gradle project in idea, and add a Class and a main function, just like

public class Test {

    public static void main(String[] args) {
        assert 2 > 1;
        System.out.println("2 > 1");
        assert 1 > 2;
        System.out.println("1 > 2");
    }

}

and add '-ea' to vm options, and the error will go out

Steps to Reproduce

public class Test {

    public static void main(String[] args) {
        assert 2 > 1;
        System.out.println("2 > 1");
        assert 1 > 2;
        System.out.println("1 > 2");
    }

}

Your Environment

very simple: jdk 8 or 11, gradle 4.10 - 6.6.1, nothing else

VeronikaVorontsova commented 1 year ago

In my case with IntelliJ Idea what solved the problem was: - Going to: File > Settings (Preferencies for Mac) > Build, Execution, Deployment - Selecting for "Build and run using": Intellij IDEA (instead of "Gradle") - Same for "Run tests using" That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.

marinaolivekey commented 2 months ago

In my case with IntelliJ Idea what solved the problem was: - Going to: File > Settings (Preferencies for Mac) > Build, Execution, Deployment - Selecting for "Build and run using": Intellij IDEA (instead of "Gradle") - Same for "Run tests using" That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.

o, thank you! your resolution helped me!!!!! I have spent many hours fixing it!