Run Executable In Jar With ProcessBuilder [duplicate]

天涯浪子 提交于 2019-12-01 11:06:42

You'd essentially be asking the OS to run an application inside of a ZIP file. I'm not aware of any way to do that without extracting it first. Even if it were a Java application, you'd need to invoke the java executable, since it knows how to parse the JAR file and access classes and resources within it.

The only fairly easy workaround I can think of would be to extract the contents of the JAR to a temporary folder and run the program from there. This can be done programmatically using the classes in java.util.zip.

You could just bundle the executable and JAR into another zip. That way, when it is extracted by the user, everything is where you expect it to be.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!