【解决错误】Command line is too long.shorten command line for xxx or also for Spring boot default configur
classpath有可能很长。如果不缩短的话,那么JVM启动命令有可能因为classpath太长导致超过了操作系统的允许的最长命令参数长度,从而导致启动失败。所以这里有3种方式可以来缩短classpath的长度,进而缩短JVM启动的参数。直接修改Shorten command line,将其设置为Jar mainfest 或者classpath file点击apply即可。
·
1. 错误描述
Command line is too long.shorten command line for xxx or also for Spring boot default configuration
2. 分析问题
jetbrains官网进行搜索,结果如下:
classpath有可能很长。如果不缩短的话,那么JVM启动命令有可能因为classpath太长导致超过了操作系统的允许的最长命令参数长度,从而导致启动失败。所以这里有3种方式可以来缩短classpath的长度,进而缩短JVM启动的参数。3种选项的意思如下:
- none(默认):不缩短JVM参数,直接把所有classpath作为JVM参数穿进去
- JAR manifest:把所有classpath写入到临时的claapath.jar包中的manifest文件中,在manifest文件的Class-Path属性中指定所有的classpath。然后JVM参数中指定classpath参数为claapath.jar所在的绝对路径
- classpath file:把所有的classpath写入到临时的文本文件中,然后把classpath设置到idea自定义的URLClassLoader中,然后使用自定义的URLClassLoader加载程序入口,反射调用main方法。main方法所在的类的ClassLoader就是idea自定义的URLClassLoader
3. 解决办法
直接修改Shorten command line,将其设置为Jar mainfest 或者classpath file点击apply即可
更多推荐
所有评论(0)