这是我的代码
File file = ResourceUtils.getFile("classpath:run.sh");
String path = file.getAbsolutePath();
但是当我这样做时
Runtime.getRunTime().exec(path)
它抛出 FileNotFoundException
class path resource [run.sh] cannot be resolved to absolute file path because it
does not reside in the file system:
jar:file:/root/backend-2.1.2.RELEASE.jar!/BOOT-INF/classes!/run.sh
最佳答案
没有。您的操作系统不知道如何从存档运行应用程序。
关于java - Runtime.getRuntime().exec 可以是类路径资源吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54454080/