Downloaded Intellij from Ubuntu Software It Is Working Fine but When I Type Java -Version on Terminal the Command Java Is Not Recognied Pops Up

My intellij program works fine and runs programs as well but when I tried to check versions from terminal the terminal did not recognize "java" in "java -version" command. Also when I type javac it asks me to install jdk whereas the jdk is already installed. I started using ubuntu two days ago so I am not familiar with how this works. Thank you for the help.

The error message I get is given as follows

$ java --version

Command 'java' not found, but can be installed with:

sudo apt install default-jre              # version 2:1.11-72, or
sudo apt install openjdk-11-jre-headless  # version 11.0.8+10-0ubuntu1~20.04
sudo apt install openjdk-8-jre-headless   # version 8u265-b01-0ubuntu2~20.04
sudo apt install openjdk-13-jre-headless  # version 13.0.3+3-1ubuntu2
sudo apt install openjdk-14-jre-headless  # version 14.0.1+7-1ubuntu1
8
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article