I've seen that virtual machines in virtualbox or VMware can be encrypted so that no one on the outside can access the disk, ram or CPU cache since the entire hardware is emulated and encrypted too. I'm wondering if this is possible with a java environment.

I want to make a secure java computing environment that cannot be accessed from the outside by anyone on the same hardware. for example, a shared server. if this is possible, if so how should i set it up?

2 Answers 2


If an attacker has root access to a machine, they can read all memory, perform debug operations, reverse engineer your java bytecode, etc. There's no practical way to prevent an attacker from obtaining a secret key that's hidden in RAM somewhere.

Ultimately, somewhere you're going to store the class files in a running JVM. If an attacker has physical access to the machine it's running on, they can get access to your class files.


I don't see any benefit of encrypting the JVM unless you have developed a custom one which I guess is not your case. So I assume you want to protect 'encrypt' the server side of your java application on a shared server, not the JVM itself.

That being said, to secure your java application you have basically two parts to take care of:

  • Securing the artifacts and essentially the compiled classes, one of used technique is the code obfuscation.
  • Protecting The data that your application has to manipulate by using encryption and hashing.

For the both points I'm sure with google you will not be disappointed :)

  • I plan on creating a virtual Java machine that will be distributed in unfamiliar environments but I want to make sure that the host can't access any data in the VM, even if they have total control over the machine. I've read that obfuscation still isn't secure as data or the private key can still be extracted from RAM. Is this a practical concern or can this be prevented? Jan 11, 2015 at 20:00
  • 1
    take a look at this javaworld.com/article/2077342/core-java/…
    – elsadek
    Jan 13, 2015 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .