Command line is too long的解决办法

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

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

  于是启动失败。

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

  1. "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">下添加如下代码:

  1. <component name="PropertiesComponent">
  2. ...
  3. <property name="dynamic.classpath" value="true" />
  4. </component>

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

发表评论

表情:
评论列表 (有 0 条评论,40人围观)

还没有评论,来说两句吧...

相关阅读