Hello @shauryadwivedi0108 ,
@meyay rightly explained that you need to use a base image with JDK/java installed on it.
if you have any specific need of Ubuntu then you may need to install jdk on the image below are some sample can be used with base Ubuntu image
RUN apt install openjdk-11-jre-headless  # version 11.0.11+9-0ubuntu2~20.04, or
RUN apt install default-jre              # version 2:1.11-72
RUN apt install openjdk-13-jre-headless  # version 13.0.7+5-0ubuntu1~20.04
RUN apt install openjdk-16-jre-headless  # version 16.0.1+9-1~20.04
RUN apt install openjdk-8-jre-headless   # version 8u292-b10-0ubuntu1~20.04
choose any version you want.
or choose any flavoured base image of Java you want.
