No, that doesn't work. There is no system call that says: "Take this piece of my memory and use this particular part of it as an image of a new process."
You can load the code into memory and go to it in the current process, but this is an ugly thing, because you need to handle all movements.
As for the specific part of Java:
You can embed a Java interpreter in your C ++ executable . You can write your own class loader for Java (via the C ++ interface for the JVM) that will load the classes from your encrypted Jar file. That way, you could avoid writing an unencrypted Jar file to disk. This, of course, will be visible in memory to everyone who has a debugger ...
Flexo source share