In a web application I'm developing, users will be able to upload java code and I will need to compile and run that. For security reasons, I'd like to that inside an LXC container, and for footprint reasons I'd like that to be a busybox. So, I created a busybox container successfully with:
lxc-create -n my-box -t busybox
It's up and running fine. Then, I downloaded jdk-8u31-linux-i586.rpm from here and ran
rpm -i jdk-8u31-linux-i586.rpm, which returned no output but created
/usr/java/jdk1.8.0_31 which all looks good.
However, when I go to
/usr/java/jdk1.8.0_31/bin and run
./javac -version, I get:
/usr/java/jdk1.8.0_31/bin # ./javac -version Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
I figured this may be because of the classpath or java_home not being the right setting, so, I created a
JAVA_HOME=/usr/java/jdk1.8.0_31 CLASSPATH=/usr/java/jdk1.8.0_31/lib PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME export CLASSPATH export PATH
This works fine, when I echo the variables they have the values I set to them. However, the problem with
java has the exact same output.
What did I miss here?
The host system is Ubuntu Server 14.04. I have tried also the x64 version, with the same result.