Elasticsearch install error: dpkg: error processing package elasticsearch (--install)

After removing the existing elasticsearch version 6. I got an error in installing elasticsearch version 7.

Here is the error message:
#dpkg -i elasticsearch-7.1.1-amd64.deb
(Reading database ... 113568 files and directories currently installed.)
Preparing to unpack elasticsearch-7.1.1-amd64.deb ...
Unpacking elasticsearch (7.1.1) over (7.1.1) ...
Setting up elasticsearch (7.1.1) ...
could not find java in JAVA_HOME or bundled at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/bin/java
dpkg: error processing package elasticsearch (--install):
subprocess installed post-installation script returned error exit status 1
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for systemd (229-4ubuntu21.21) ...
Errors were encountered while processing:

can anyone help me on this issue.

Install java 1.8.0 instead of using java 8. The elastic matrix compatibility is shown here.

Thank you @TsuWeiQuan