使用命令 java -jar springBoot.jar 启动项目,结果报错如下:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37 at java.lang.String.substring(String.java:1963) at org.springframework.boot.loader.jar.JarFile.createJarFileFromDirectoryEntry(JarFile.java:278) at org.springframework.boot.loader.jar.JarFile.createJarFileFromEntry(JarFile.java:258) at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:248) at org.springframework.boot.loader.jar.JarFile.getNestedJarFile(JarFile.java:237) at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive(JarFileArchive.java:103) at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchives(JarFileArchive.java:87) at org.springframework.boot.loader.PropertiesLauncher.addNestedEntries(PropertiesLauncher.java:480) at org.springframework.boot.loader.PropertiesLauncher.getClassPathArchives(PropertiesLauncher.java:418) at org.springframework.boot.loader.Launcher.launch(Launcher.java:49) at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:521)
原因是,Spring Boot项目中,resources目录中,含有中文的文件夹,所以导致报错,所以,以后文件夹和文件的命名,一定最好使用英文!!!!
原文地址:https://www.cnblogs.com/jiafuwei/p/8514637.html
时间: 2024-10-22 07:30:45