Skip to content

Guide on building OpenJDK for Zinc Native

lockieluke edited this page Jan 4, 2021 · 2 revisions

Guide on building OpenJDK for Zinc Native

Zinc Native is a module that helps Zinc to operate performance-intensive tasks and to support multithreading since NodeJS doesn't support multithreading. However, Zinc Native is written Java so it needs OpenJDK to run. Using the OpenJDK that is available to download on the Internet is too big and heavy for Zinc Native although you can use it if you don't mind the problem of size.

Build prerequisites

  • OpenJDK 15(recommended) installed and is added to PATH
  • Python(If you are using method 2) and is added to PATH
  • NodeJS (It is required for developing Zinc although it is not used in this guide)

Method 1 - Build manually

  1. Navigate to any directory e.g. Desktop

    cd Desktop
  2. Build OpenJDK 15 into java-runtime folder (Actually the name doesn't matter)

    jlink --verbose --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules="jdk.unsupported,java.sql,java.desktop,java.naming,java.management,java.instrument,java.security.jgss" --output="./java-runtime"
  3. Move the bin and lib folder into a new folder named java under Zinc's project directory which should looks like this

    Zinc
    -...
    -java
     -bin
     -lib
    -...
    

Method 2 - Build automatically(Make sure python is installed, only works on Windows currently)

  1. Make sure you have the latest development scripts

    yarn update-submodules
  2. Build JDK with prebuilt python script and execute it with a yarn command

    yarn jdk-init
  3. Hmm that's it 🤔? Err yea, it's that simple. You should now see a folder named java placed in the project directory

Clone this wiki locally