occlum/demos/font/font_support_for_java/README.md
superajun-wsj bef3201aef Update demos/font/font_support_for_java/README.md
OK

Co-authored-by: Zongmin.Gu <59240482+guzongmin@users.noreply.github.com>
2020-10-21 17:41:49 +08:00

1.9 KiB

Make Occlum support font

This project demonstrates how Occlum support font with a Java demo in SGX enclaves.

About JDK

Both the unmodified OpenJDK 11, which is imported from Alpine Linux, and the Alibaba Dragonwell, which is a downstream version of OpenJDK, are supported now. We have already installed OpenJDK and Dragonwell while building the Docker image, the OpenJDK is installed at /opt/occlum/toolchains/jvm/java-11-openjdk, and the Dragonwell is installed at /opt/occlum/toolchains/jvm/java-11-alibaba-dragonwell.

Our demos use Dragonwell as the default JDK, you are free to change to OpenJDK by setting the JAVA_HOME to point to the installation directory of OpenJDK and copying it into Occlum instance.

Demo: Java excel file writting with Poi

We provide a excel file writting demo to show how to make occlum support font inside SGX enclaves.

Create demo and build it

Excel writting demo is created in create_java_font_app.sh, and the script also creates a build.gradle to build demo. Then a docker container is created to build the demo and we will get a fat jar file. The docker container is based on Alpine, we will collect all dependency libs and font in document font-lib from the container.

Run demo in Occlum container

Create occlum instance and copy all libs into occlum image which font dependence in occlum container, then build the occlum image and run the demo.

How to Run

Step 1: Create and build demo, also collect font dependency occlum needs

./create_java_font_app.sh

Step 2: Create occlum instance and run the demo in occlum's latest docker image release

docker run -it --device /dev/isgx --rm -v pwd:pwd -w pwd occlum/occlum:[latest version]-ubuntu18.04 pwd/run_java_font_app_internal.sh

Step 3: To check whether it works, a Demo.xlsx file should be created in occlum image host path.