Search code examples
javajwrapper

JWrapper JWSystem.forkVirtualApp()


The JWrapper support page directed me to ask this question here so:

I've successfully used JWrapper to create deployment files for my application. A lot of command line stuff is involved and I want to cut down on these. My question is, will the method above help, and how to use it, and effectively? Since other sources of info on JWrapper are either gone or need more detail, I want to request for answers here.


Solution

  • When you use the JWSystem.forkVirtualApp method the command line args will be the same as you specify in the jwrapper XML file for all your virtual apps, the command line args that you can pass in are command line args for your virtual app rather than for the JVM launch.

    We have an open request to make the JVM args more flexible in general / editable at runtime which I would say would encompass your request and a bit more (we'll note your interest on it too), but for the main requirement of ensuring you are using the same JWrapper-bundled JRE and not the system JRE you can use JWSystem.getMyJreHome. This will always return the JRE that was used to launch your existing virtual app and you can build a custom launch from there.

    JWrapper could support a more arbitrary Java launch but it wouldn't provide anything much more than the JWSystem.getMyJreHome + building the path to the java executable so I'm not sure it would provide much if any benefit over JWSystem.getMyJreHome + the Java process builder API?

    It could also easily support custom JVM args in the launch but we would want to consider whether it makes sense to add this as an API in addition to a more complete ability to have runtime editing of the JVM args for virtual apps. It is something we plan to look into though.