This is not possible with Oracle VM at this time.
But I agree that this would be a good feature, especially since Java has all the information necessary for this automatically.
At the top of my hat, I think JIT is the only reason why this cannot work: JIT takes into account runtime behavior. Therefore, if application A uses some code in a different template than application B, this will lead to the creation of assembler code generated at runtime.
But then the usual "template" is "how often this code is used." Therefore, if application A called some method very often, but B didn’t, they could still share the code, because A already paid the price for optimization / compilation.
What you can try is to deploy several applications as WAR files into one virtual machine. But, in my experience, this often causes problems with code that incorrectly cleans stream locators or shuts down.
Aaron digulla
source share