IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App

简介: IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App

今天在使用IDEA启动一个开源项目的时候,报了一个错误。具体错误内容如下:

Error running ‘Application’:

Command line is too long. Shorten command line for SpringBootMainApplication or also for Application

查阅了下原因,但是一般的博客都仅仅是介绍了如何解决,问题的原因和为什么这样子解决都完全没有提及,下面我就查到的资料做下简单的分析。

问题分析

错误原因:

看报错的那段英文,可知是命令行太长的原因导致SpringBoot整个应用无法成功启动,那为什么会报这样一个错误呢?

错误分析

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

错误解决:

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

具体解决步骤

Step1:找到项目目录下的.idea\workspace.xml文件

具体位置如下图所示:

Step2:找到workspace.xml文件下的PropertiesComponent标签栏

Step3:在PropertiesComponent标签栏内添加如下代码

<property name="dynamic.classpath" value="true" />

配置的主要功能就是开启IDEA的动态类路径,将太长的类路径写入文件,然后由应用程序启动器读取并通过系统类加载器加载

具体实现可以查看IDEA社区版源代码JdkUtil.java文件,setupJVMCommandLine方法。

链接如下: IDEA源代码

目录
相关文章
|
6天前
|
Java
Intellij IDEA运行报Command line is too long的解决办法
Intellij IDEA运行报Command line is too long的解决办法
|
6天前
四种解决”Arg list too long”参数列表过长的办法
这些方法都可以帮助你避免因参数列表过长而导致的错误。选择方法取决于具体情况和需求。
16 0
Error running Application. Command line is too long.
【2月更文挑战第2天】Error running Application. Command line is too long. 问题处理
|
6月前
|
Java
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
44 0
|
6天前
|
JSON JavaScript 前端开发
解决js中Long类型数据在请求与响应过程精度丢失问题(springboot项目中)
解决js中Long类型数据在请求与响应过程精度丢失问题(springboot项目中)
50 0
|
6天前
|
编译器 C语言
c语言中long的作用类型
c语言中long的作用类型
37 0
|
7月前
|
Java
【面试题精讲】Java超过long类型的数据如何表示
【面试题精讲】Java超过long类型的数据如何表示
|
6天前
|
存储
TS 自定义结构Long与number类型相互转换
TS 自定义结构Long与number类型相互转换
|
6天前
|
Oracle 关系型数据库 数据库
Flink Sink to Oracle 存在字段CLOB类型,如何处理错误”ORA-01461: 仅能绑定要插入LONG的LONG值“
做Flink CDC同步数据过程中,目标是Oracle数据库,其中某个字段较大被设置为CLOB类型,其中会遇到异常,”ORA-01461: 仅能绑定要插入LONG的LONG值“
|
6天前
|
存储 前端开发 JavaScript
由Long类型引发的生产事故
由Long类型引发的生产事故

热门文章

最新文章