当前位置: 首页 > 知识库问答 >
问题:

进程“命令”C:\程序文件\Java\jdk\bin\java.exe“以非零退出值 1 eclipse 完成

倪鸿禧
2023-03-14
**Error :** Process 'command 'C:\Program Files\Java\jdk\bin\java.exe'' finished with non-zero exit value 1

这个错误是得到当我运行的任务是build.gradle文件如下,

 plugins {
    id 'application'
    id 'eclipse'
}

// remove the Javadoc verification
tasks.withType(Javadoc) {
    options.addStringOption('Xdoclint:none', '-quiet')
}

// Build version
version = '1.2.6-SNAPSHOT'

sourceCompatibility = '1.8'

artifactory {
    publish {
         repository.repoKey = 'ent-public-local-builds'
    }
}

eclipse.classpath {
    containers = containers.collect {
        it.replace 'org.eclipse.jdt.launching.JRE_CONTAINER',
            'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/DeveloperJavaJDK'
    }
}

//Core Spring version numbers
def springVersion = '5.1.9.RELEASE'
def springBatchVersion = '4.1.2.RELEASE'

//Junit version
def junitVersion = '5.5.1'

//updated to use Transitive Dependencies
dependencies {
    // include Spring JARs and dependencies
    implementation 'org.springframework:spring-oxm:' + springVersion
    implementation 'org.springframework:spring-webmvc:' + springVersion
}

reporting.baseDir = "my-reports"
testResultsDirName = "$buildDir/my-test-results"

application {
    mainClassName = 'com.automation.MyClass'
}
task runWithJavaExec(type: JavaExec) {
   // group = 'Execution'
   // description = "Run the main class with JavaExecTask"
    classpath = sourceSets.main.runtimeClasspath
    main = 'com.automation.MyClass'
}
runWithJavaExec.onlyIf { project.hasProperty('Execution')}

我使用下面的命令运行这个任务,

gradle runWithJavaExec

最后,我想知道如何通过gradle命令运行java类?除了创建任务之外还有其他可能性吗?如果是,请相应地分享。请帮助我解决这个问题。

共有3个答案

潘翊歌
2023-03-14

更改运行springboot应用程序的端口号。它对我有用。

赵景曜
2023-03-14

当您在代码中定义属性文件或某个文件时,通常会发生这种情况,但是当应用程序运行时,它会尝试获取该文件,但它无法在项目中找到文件。应将文件移动到资源文件夹。

莘钧
2023-03-14

如果您使用intellij,只需使缓存无效并重新启动

 类似资料: