文章目录

1. 复现错误


今天启动spring boot项目时,却出现如下错误:

Error running ‘Application’: Command line is too long. Shorten command line for SpringBootMainApplication or also for Spring Boot default configuration

2. 分析问题


Error running ‘Application’: Command line is too long. Shorten command line for SpringBootMainApplication or also for Spring Boot default configuration错误,翻译成中文,如下图所示:

在这里插入图片描述

通过翻译后的报错信息来看,可知是命令行太长的原因导致SpringBoot和整个应用无法成功启动,那为什么会报这样一个错误呢?

其实IDEA底层是通过命令行或者文件的方式将classpath传递到JavaJVM虚拟机上的,而大多数的操作系统都会有命令行的最大长度限制,超过这个限定值时就会导致IDEA无法启动当前程序。

当命令行长度大于32768个字符时,将IDEA切换到动态类路径。长类路径被写入文件,然后由应用程序启动器读取并通过系统类加载器加载。

3. 解决错误


按修改命令行的方式,shorten command line 选项选择 JAR manifest 或者 classpath file 选项,最后apply

 

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐