6

I am running gradle bootRun

gradle bootRun --args='--spring.profiles.active=local' --stacktrace

I am getting a CreateProcess error=206, The filename or extension is too long exception

Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :bootRun FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
> A problem occurred starting process 'command 'C:\JDK8\jdk1.8.0_111\bin\java.exe''
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
        ...
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\JDK8\jdk1.8.0_111\bin\java.exe''
        at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:231)
        at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:209)
        at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:355)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:85)
        at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
        ... 3 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\JDK8\jdk1.8.0_111\bin\java.exe'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
        at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:67)
        ... 4 more
Caused by: java.io.IOException: Cannot run program "C:\JDK8\jdk1.8.0_111\bin\java.exe" (in directory "C:\Users\E080978\git\order-management-api"): CreateProcess error=206, The filename or extension is too long
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 7 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
        ... 8 more

My configurations: - Gradle Version: 4.9 - JDK Version: jdk1.8.0_111 - Windows 10

Ayman Arif
  • 1,456
  • 3
  • 16
  • 40
  • 3
    Does this answer your question? [CreateProcess error=206, The filename or extension is too long when running main() method](https://stackoverflow.com/questions/10519558/createprocess-error-206-the-filename-or-extension-is-too-long-when-running-main) – Mebin Joe Apr 06 '20 at 10:36
  • Can someone remove duplicate. My question is regarding the exception for IntelliJ and the answer is given for Eclipse bug – Ayman Arif Apr 07 '20 at 10:46
  • @MebinJoe Changed question – Ayman Arif Apr 08 '20 at 06:08
  • 2
    @AymanArif Voting to reopen. The linked duplicate is clearly not remotely relevant for your problem. – skomisa Apr 09 '20 at 17:45

1 Answers1

1

Since you are using Gradle on windows, you may encounter this error if you have a large number of dependencies in your classpath. This is due to the limitation on number of characters in executing command.

Try this solution from another thread:

plugins {
    id "com.github.ManifestClasspath" version "0.1.0-RELEASE"       
}

apply plugin: "com.github.ManifestClasspath"

springBoot {
    mainClassName = 'com.pb.ngp.identity.manager.KeyManagerApplication'
}

You may encounter following error:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.

Caused by: org.gradle.api.InvalidUserDataException: Main class name has not been configured and it could not be resolved

Then simply specify the main class. e.g.

springBoot {
    mainClassName = 'com.example.SpringBootApplication'
}
K D
  • 31
  • 6