Command line is too long的解决办法

我的梦境 提交于 2019-12-09 05:32:45

  本人用IDEA启动一个新的项目,在项目启动时,出现下面的故障码:

Error running 'Application';
Command line is too long.Shorten command line for Application or also for Spring Boot default configuratin.

  于是启动失败。

  后来经过排查,发现idea在项目启动时其实是执行了如下的命令行:

"C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.212-3\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\Dev\IDE\IDEA\IntelliJ IDEA 2018.3.5\lib\idea_rt.jar=51042:D:\Dev\IDE\IDEA\IntelliJ IDEA 2018.3.5\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\Dell\AppData\Local\Temp\classpath443986179.jar com.xxx.Application

  由此我们得知,正是由于该命令行超长,因而触发了IDEA的启动报错,解决办法是将其改为动态类路径

  在项目的根目录下的.idea/workspace.xml文件中的<component name="PropertiesComponent">下添加如下代码:

<component name="PropertiesComponent">
	...
	<property name="dynamic.classpath" value="true" />
</component>

  之后再次启动,问题解决。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!