Could not create the Java virtual machine.

I have a brand new VPS on, that runs on overvz.

My OS is Linux Ubuntu 12.04 and i needed to install tomcat-solr. By running

sudo apt-get install ca-certificates-java


I was getting the error:

Could not create the Java virtual machine.

By following this link i found that oracle java7 works perfectly on Ubuntu over openvz.

All I needed to do was:

  • Remove openjdk
sudo apt-get purge openjdk*

  • Add the repository
sudo add-apt-repository ppa:eugenesan/java
sudo apt-get update

  • Install java7 sdk
sudo apt-get install oracle-java7-installer

  •  Now the tomcat-solr will work as excpected
sudo apt-get install tomcat-solr


Hope it works, good luck to your new server :)