IDEA debug时报错
Error running AxPersonListTest.test. Command line is too long. Shorten the command line via JAR manifest or via a classpath file and rerun.
![](https://img-blog.csdnimg.cn/img_convert/3b3dd931183046f3a5b8aeee0247f6e2.png)
问题分析
这种异常出现一般是因为运行项目的指令过长引起的,IDEA进行代码运行时会加载很多指令,这些指令拼接后的长度超出了系统的最大长度,当你的命令行长度超过 32768 个字符时,IDEA就会提示你使用短一点的命令行。
大家可以在运行项目是看一下console输出的第一行日志,一般就是你的运行conmand。
解决办法一
点击“Edit Configurations...”
![](https://img-blog.csdnimg.cn/img_convert/46336d39f0b04d0e9c11aeeb903c2094.png)
选择左侧应用,点击“Modify options”
![](https://img-blog.csdnimg.cn/img_convert/3fe604e542914001816bcdf5c973e9f0.png)
点击“Shorten command line”
![](https://img-blog.csdnimg.cn/img_convert/02b47f9d898b4bb7aa96378383925df9.png)
选择“JAR manifest”
![](https://img-blog.csdnimg.cn/img_convert/14cf69c9244a454f94dfbc246024cd1c.png)
最后点击“Apply”应用即可
解决办法二
在idea的.idea/workspace.xml中开启动态路径。
在workspace.xml中的
<component name="PropertiesComponent">条目下添加属性
<property name="dynamic.classpath" value="true" />
可以使idea在执行通过动态路径去寻找项目路径。