jnipp icon indicating copy to clipboard operation
jnipp copied to clipboard

Support for loading custom jars/classes and/or setting additional JVM options

Open sanel opened this issue 2 years ago • 1 comments

Hey guys, great project! I've noticed that there is no option to load a custom jar, because JavaVMInitArgs is hidden [1] from the public access. AFAIK, to load a custom jar/class from JNI, it neads to set JavaVMOption. Something like this (not tested):

JavaVMInitArgs args;

JavaVMOption options[1];
options[0].optionString = "-Djava.class.path=path/to/lib1.jar;path/to/lib2.jar"

args.options=options;
args.nOptions=1;

Maybe a version of Vm constructor with JavaVMOption migth do the trick? Like:

Vm::Vm(const char *path, JavaVMOption *opts = nullptr) { ... }

[1] https://github.com/mitchdowd/jnipp/blob/master/jnipp.cpp#L1462

sanel avatar Nov 16 '23 17:11 sanel

really needed

normalzero avatar Mar 03 '24 11:03 normalzero