Spring Boot 啟動報錯 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37
阿新 • • 發佈:2018-03-06
work 結果 frame getc director inf 中文 getclass post
使用命令 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目錄中,含有中文的文件夾,所以導致報錯,所以,以後文件夾和文件的命名,一定最好使用英文!!!!
Spring Boot 啟動報錯 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37