【IDEA异常处理】 Command line is too long

问题描述:

在启动项目的时候idea报异常:

Error running 'WebApplication': Command line is too long. Shorten command line for WebApplication or also for Spring Boot default configuration.

【IDEA异常处理】 Command line is too long

解决方法:

打开项目的.idea文件夹下的workspace.xml

【IDEA异常处理】 Command line is too long

找到标签 <component name="PropertiesComponent"> , 在标签里加一行  <property name="dynamic.classpath" value="true" />

【IDEA异常处理】 Command line is too long

就可以正常启动了。

扩展:

dynamic.classpath作用:该选项控制如何将classpath传递给JVM:通过命令行或通过文件。大多数操作系统都有最大的命令行限制,当它超过时,IDEA将无法运行您的应用程序。 当命令行长于32768个字符时,IDEA建议您切换到动态类路径。长类路径被写入文件,然后由应用程序启动器读取并通过系统类加载器加载。 如果您对实施细节感兴趣,可以查看IDEA社区版的源代码,JdkUtil.java文件,setupJVMCommandLine方法(dynamic.classpath作用