Natta Wang
Natta Wang

Reputation: 551

Why I couldn't run same installed app on IDE integrated terminal even I could run on default terminal

I just switch to try develop on Linux for a while.

But one thing I couldn't understand how to solve it, as I mentioned in topic.

I'm going to develop a project that need Java SDK, then I installed the SDK with command:

#bash
sudo apt install openjdk-17-jdk-headless

After installation finished, I could run command java -version and javac -version to see the result of installation and it looks OK.

openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment (build 17.0.3+7-Ubuntu-0ubuntu0.22.04.1)
OpenJDK 64-Bit Server VM (build 17.0.3+7-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)

And then when I open IDE (Intellij IDEA) and it has feature of integrated terminal. (see picture)

But when I try to test java -version it was shown the error:

bash: java: command not found

As you can see from picture, I run java -version on terminal it return output properly, but when I run the same command java -version, it output with error message, like it couldn't find the java SDK that I installed.

Could anyone help me to describe the reason and solutions to solve the issue?

P.S. This is same on VS Codium.

java command not found on integrated terminal

Upvotes: 0

Views: 131

Answers (1)

Natta Wang
Natta Wang

Reputation: 551

I found the answer.

Solution:

Install the IDE app with the file from official website instead of using package manager of OS.

Description:

The cause is I installed the IDE via Package Manager of OS (here I'm using Pop_OS, install via Pop!_Shop)

And its package manager has some strict rules for security purpose. I'm not sure, Pop_OS using which package manager, but I'll raise Flatpak as reference: https://docs.flatpak.org/en/latest/sandbox-permissions.html

And on blacklisted directories, my installed java command is under /usr/bin/ which is in blacklist.

Upvotes: 1

Related Questions