Ah yes, that’s true for v0.1.2 - preferences are stored on a per-user basis, presumably including the max memory setting. However in v0.2.0 that won’t be/isn’t possible for the memory setting, since JDK 8 handles this differently through javapackager, which isn’t available in later versions. The only way I’ve found around that in v0.2.0 is for QuPath to write its own memory setting to the .cfg file (which seems to work, but I can image it may suffer permissions problems at some point if a full installer is used…).
Anyhow, there is a bit more about the command line here. The format should be something like
java -jar QuPathApp.jar /path/to/image/or/qpdata/file -script /path/to/script
You should then be able to add
Xmx4G there (and skip the image/qpdata file and script). I believe this will also bypass the normal launcher and its application of memory settings.
If this looks promising, the next challenge is likely to be ensuring that
-Djava.library.path is set appropriately so that OpenSlide works and/or Bio-Formats + the Bio-Formats extension are found on the classpath. One approach for OpenSlide could be to ensure the current working directory is the one containing the native libraries associated with QuPath when it is launched.