【问题标题】:Can Runtime.getRuntime().exec a classpath resource?Runtime.getRuntime().exec 可以类路径资源吗?
【发布时间】:2019-01-31 05:46:40
【问题描述】:

这是我的代码

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 spring exec


    【解决方案1】:

    没有。您的操作系统不知道如何从档案中运行应用程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-11
      • 1970-01-01
      • 2013-08-02
      • 1970-01-01
      • 2013-03-20
      • 2011-01-09
      • 2015-08-28
      相关资源
      最近更新 更多