Java Compilation on CheerpX and not CheerpJ

Hey i'm new to using Cheerpx, and I think its super cool! I've been playing around with my fork of https://github.com/leaningtech/webvm and seeing how I can change the Dockerfile. My current objective is to have Java work on my container. While I could just use Cheerpj, I wanted to be able to support user input through Scanner (and as far as I know, this isn't supported with CheerpJ) and also have more file flexibility. Has anyone figured out how to do it? Here's my Dockerfile:
FROM --platform=i386 i386/debian:buster

ARG DEBIAN_FRONTEND=noninteractive

# Install required packages
RUN apt-get clean && apt-get update && apt-get -y upgrade && \
apt-get -y install apt-utils \
python3 unzip nodejs \
fakeroot dbus base hexedit \
patch ucf file dialog curl \
less nano openjdk-11-jdk-headless openjdk-11-jre-headless && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Set environment variables for JVM compatibility
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-i386"
ENV PATH="${JAVA_HOME}/bin:$PATH"
ENV LD_LIBRARY_PATH="${JAVA_HOME}/lib/server:$LD_LIBRARY_PATH"

# These are just some random things I was trying to get it to work. I've been losing my mind.
ENV JAVA_TOOL_OPTIONS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:ActiveProcessorCount=1 -XX:-UseContainerCpuShares -XX:-UseContainerSupport -Djava.awt.headless=true"

RUN useradd -m user && echo "user:password" | chpasswd
COPY --chown=user:user ./examples /home/user/examples

WORKDIR /home/user/
ENV HOME="/home/user" TERM="xterm" USER="user" SHELL="/bin/bash" EDITOR="vim" LANG="en_US.UTF-8" LC_ALL="C"

RUN echo 'root:password' | chpasswd

# Default command
CMD [ "/bin/bash" ]

# RUN IMAGE AS 950M
FROM --platform=i386 i386/debian:buster

ARG DEBIAN_FRONTEND=noninteractive

# Install required packages
RUN apt-get clean && apt-get update && apt-get -y upgrade && \
apt-get -y install apt-utils \
python3 unzip nodejs \
fakeroot dbus base hexedit \
patch ucf file dialog curl \
less nano openjdk-11-jdk-headless openjdk-11-jre-headless && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Set environment variables for JVM compatibility
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-i386"
ENV PATH="${JAVA_HOME}/bin:$PATH"
ENV LD_LIBRARY_PATH="${JAVA_HOME}/lib/server:$LD_LIBRARY_PATH"

# These are just some random things I was trying to get it to work. I've been losing my mind.
ENV JAVA_TOOL_OPTIONS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:ActiveProcessorCount=1 -XX:-UseContainerCpuShares -XX:-UseContainerSupport -Djava.awt.headless=true"

RUN useradd -m user && echo "user:password" | chpasswd
COPY --chown=user:user ./examples /home/user/examples

WORKDIR /home/user/
ENV HOME="/home/user" TERM="xterm" USER="user" SHELL="/bin/bash" EDITOR="vim" LANG="en_US.UTF-8" LC_ALL="C"

RUN echo 'root:password' | chpasswd

# Default command
CMD [ "/bin/bash" ]

# RUN IMAGE AS 950M
When the vm is deployed and I run java -version in the browser, I get this message:
Error occurred during initialization of VM
getcpu(2) system call not supported by kernel
Error occurred during initialization of VM
getcpu(2) system call not supported by kernel
Running javac hangs indefinitely. I would very much appreciate help!
GitHub
GitHub - leaningtech/webvm: Virtual Machine for the Web
Virtual Machine for the Web. Contribute to leaningtech/webvm development by creating an account on GitHub.
1 Reply
apignotti
apignotti3w ago
Hi, both java and javac can be certainly be made to work, but they are using some syscalls that are not yet supported by CheerpX. I will add this problem to our internal bug tracker and I might recommend for you to create a public GitHub issue so that you can be notified when the problem is eventually fixed. Please understand that getting to work is not a high priority for us, since we provide CheerpJ that is a much better solution to this problem.
Want results from more Discord servers?
Add your server