2

I made a simple web application using Spring Boot, PostgreSQL, Maven for backend and Angular 2 for front-end. While running the backend with maven I am getting the error like

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.BUILD-SNAPSHOT:run (default-cli) on project backend: Could not exec java: Cannot run program "C:\Program Files\Java\jdk1.8.0_131\jre\bin\java.exe": CreateProcess error=206, The filename or extension is too long -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.BUILD-SNAPSHOT:run (default-cli) on project backend: Could not exec java at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345) at org.apache.maven.cli.MavenCli.main(MavenCli.java:191) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Could not exec java **

Kindly let me know is there any fix for this. I even tried by changing the Java classpath. which was suggested in a similar problem. kindly let me know if anyone has any idea to fix it.

I went through this link "CreateProcess error=206, The filename or extension is too long when running main() method" and It is not similar to it because, I am using Maven and SpringBoot and I also tried to fix it by changing the classpath. I cleaned , installed using maven and there is no error while building and when i tried to run "mvn spring-boot:run -Drun.profiles=h2database-file" this command I am getting the following error.

Nasrul Bharathi
  • 163
  • 2
  • 10
  • can you execute the following command and post the stack trace. `mvn clean install -e` – Jobin Jun 06 '17 at 05:57
  • @Stephen , I went through this link "CreateProcess error=206, The filename or extension is too long when running main() method" and It is not similar to it because, I am using Maven and SpringBoot and I also tried to fix it by changing the classpath. I cleaned , installed using maven and there is no error while building and when i tried to run "mvn spring-boot:run -Drun.profiles=h2database-file" this command I am getting the following error. . Kindly provide some suggestion on this. – Nasrul Bharathi Jun 06 '17 at 07:13
  • The Q&A lists multiple possible solutions. While the context of your question is SpringBoot, the problem is essentially the same. So my suggestion is to try the other solutions, one at a time. And if that fails, switch to building on Linux. Or do something hacky like assembling your dependencies into an Uber-JAR. – Stephen C Jun 06 '17 at 11:13
  • I tried all possible solutions present in the link "CreateProcess error=206, The filename or extension is too long when running main() method 11 answers" . The issue is not resolved. It occurs in Maven build in a particular system only. For the rest of the people it is working fine. I uninstalled all the s/ws like java, eclipse, maven and git and then installed again got the same error . Kindly look into this and provide some suggestions . – Nasrul Bharathi Jun 19 '17 at 05:01
  • Actually I resolved the issue by reducing the path directory of Maven. The error which occured for me is not related to Java or Eclipse – Nasrul Bharathi Jun 23 '17 at 09:48

0 Answers0