Issue with compiling a project

Hi Friends,

I am getting back to cocos2d-x after almost half a decade. And having issue trying to compile a new JS project.

I have a fresh Ubuntu 18.04 box setup with Java 1.8, Cmake, and all other dependencies as mentioned @ https://docs.cocos.com/cocos2d-x/manual/en/installation/Linux.html

Now when I create and run new project with

cocos new -l js test
cd test
cocos run -p web

It works flawlessly.

But when I try to compile with
cocos compile -p web -m release
I am getting

Building mode: release
No valid JDK found

I tried adding

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export PATH=$JAVA_HOME:$PATH

and then

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre"
export PATH=$JAVA_HOME:$PATH

and then

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin"
export PATH=$JAVA_HOME:$PATH

With each of above settings, sourced .bashrc and tried running
cocos compile -p web -m release
only to get

Building mode: release
No valid JDK found

Any hint on what am I doing wrong? Highly appreciate any responses.

Thanks.

Got this working with Java 1.7 and Apache ant 1.9

As defined in /tools/cocos2d-console/plugins/plugin_compile/build_web/init.py, cocos2dx 3.17.2, works only with Java 1.6 or 1.7