IDEA使用实战:Error running $classname: Command line is too long. Shorten command line for $classname

IDEA-项目启动报错Error running $classname: Command line is too long. Shorten command line for $classname

原因分析

之所以出现这个原因可能是因为打印的环境变量太长了,超过了限制,可以尝试以下方案:

方案1.

按照提示修改该类的配置,选择jar manifest(每个报错的类都需要注意设置,项目的.idea/workspace.xml有这个选项,可以修改默认值,这样就不用每次更改)
IDEA使用实战:Error running $classname: Command line is too long. Shorten command line for $classname

方案2.

在项目的.idea/workspace.xml文件中,找到 <component name="PropertiesComponent">
,添加一行<property name="dynamic.classpath" value="true" />(网上的方法是这种,但我只做了这一个设置无效,必须设置第一种才有效)
IDEA使用实战:Error running $classname: Command line is too long. Shorten command line for $classname

(以上对workspace.xml的修改 均可以在idea的安装配置文件中修改,以达到对所有项目有效的目的)