How I can execute a jar file included in my c++ exe file in a Base64 string without write it on the HDD? Is it possibile execute it from memory or something like this without have 2 files on the HDD?
Thanks in advance
Using JNI:
Another way is to call JNI's:
jclass DefineClass(JNIEnv *env, const char *name, jobject loader,
const jbyte *buf, jsize bufLen);
Example: https://github.com/Brandon-T/Cpp-JVM
I added the example to my Github since it was way too large to fit on StackOverflow. Note: You do not need the JNI wrapper that I wrote. It would cut down on code by a ton if you use raw JNI.
The wrapper is there from some legacy code I wrote a long time ago and I decided to just use it and have it keep track of the JavaVM and JNIEnv for me.
EDIT: Beware that I hardcoded the path to libJVM and libJNI:
https://github.com/Brandon-T/Cpp-JVM/blob/master/JVM.cpp#L41 because I couldn't get the JVM running on OSX without it.