dockersencha-cmdjava-21

How to install Sencha Cmd 7.8.0.59 (linux-amd64) on eclipse-temurin:21 docker image


I'm trying to install Sencha Cmd 7.8.0.59 on the eclipse-temurin:21 docker image;

FROM eclipse-temurin:21 as builder

ENV CMD_VERSION="7.8.0.59"

RUN apt-get update && apt-get install -y --no-install-recommends \
        wget \
        unzip \
        libfreetype6 \
        fontconfig \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /work

RUN wget --no-cookies https://cdn.sencha.com/cmd/${CMD_VERSION}/no-jre/SenchaCmd-${CMD_VERSION}-linux-amd64.sh.zip \
    && unzip SenchaCmd-${CMD_VERSION}-linux-amd64.sh.zip -d . \
    && chmod o+x SenchaCmd-${CMD_VERSION}-linux-amd64.sh \
    && ./SenchaCmd-${CMD_VERSION}-linux-amd64.sh -Dall=true -q -dir /opt/Sencha/Cmd/${CMD_VERSION}

However, running the installer fails with

No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.

Running java -version from within an eclipse-temurin:21 container yields

openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)

And running `echo "$JAVA_HOME" yields

/opt/java/openjdk

Does anybody have any idea how to get this to work? Is it a bug in the Sencha Cmd 7.8.0.59 installer for Linux? (7.8.0.59 works fine with termurin 21 on my M2 Mac using the osx-arm-installer.)


Solution

  • The error message really says it all - you need to install Java 8 (provided on Ubuntu by the openjdk-8-jdk package) and set INSTALL4J_JAVA_HOME to its location:

    FROM eclipse-temurin:21 as builder
    
    ENV CMD_VERSION="7.8.0.59"
    
    RUN apt-get update && apt-get install -y --no-install-recommends \
            wget \
            unzip \
            libfreetype6 \
            fontconfig \
            openjdk-8-jdk \
        && rm -rf /var/lib/apt/lists/*
    
    # Point the install to OpenJDK 8
    ENV INSTALL4J_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
    WORKDIR /work
    RUN wget --no-cookies https://cdn.sencha.com/cmd/${CMD_VERSION}/no-jre/SenchaCmd-${CMD_VERSION}-linux-amd64.sh.zip \
        && unzip SenchaCmd-${CMD_VERSION}-linux-amd64.sh.zip -d . \
        && chmod o+x SenchaCmd-${CMD_VERSION}-linux-amd64.sh \
        && ./SenchaCmd-${CMD_VERSION}-linux-amd64.sh -Dall=true -q -dir /opt/Sencha/Cmd/${CMD_VERSION}