Run *.exe file from inside JAR

后端 未结 2 1621
耶瑟儿~
耶瑟儿~ 2020-12-10 22:22

I have a huge JAR file, which I created with Maven Shade plugin.

I run this with java -jar foo.jar , and my UI opens. Now I want to execute

2条回答
  •  隐瞒了意图╮
    2020-12-10 23:07

    Copying the file to a temporary location and running it is the way to go. The answer you linked to does much more work that necessary, as you can get your exe file as an InputStream and copy it to a file with a utility like Apache Commons IO FileUtils.copy(in, out)

    See How do I copy a text file from a jar into a file outside of the jar? for example.

提交回复
热议问题