How to execute script from JAR file?

前端 未结 3 1149
醉酒成梦
醉酒成梦 2020-12-19 17:55

I have a maven project, in which, I am trying to execute a script (written in R). I put this script file in the source code directory as well. I found this script is not exe

3条回答
  •  悲&欢浪女
    2020-12-19 18:13

    I would do the following:

    • Get InputStream for the file with ClassLoader.getResourceAsStream()
    • Write this InputStream to tmp dir
    • Execute it with Runtime.getRuntime().execute(..)

提交回复
热议问题