1

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 /etc/profile:

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 javac persists. 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.

2
  • It is possible the heap is too small on your container or a 32/64-bit issue.
    – Ketan
    Feb 19, 2015 at 1:22
  • @Ketan thank you for your help - as it turned out the problem seems to have been a different one though.
    – user37050
    Feb 19, 2015 at 6:32

1 Answer 1

1

As it turns out, the problem was the same as here: I still had to unpack the *.pack files from the lib and jre/lib folders in the java installation. unpack200, the program used to unpack *.pack files to .jar files isn't available in busybox, but it's shipped with java.

You must log in to answer this question.