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.
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的安装配置文件中修改,以达到对所有项目有效的目的)