I encountered a very strange problem. I configured the java environment on ubuntu. However, the command line terminal javac can be used, but as soon as I use idea, an error is reported and java cannot be detected. Error message: ubuntu cannot run program "javac": error=2。
At first the jdk version I used was ···amazon-corretto-8-x64-linux-jdk···
like:···wget https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gztar -xvf amazon-corretto-8-x64-linux-jdk.tar.gz···
And I configured environment variables for it, and executing java -version on the command line has the correct version output. But when idea kept reporting errors and could not detect the java version, I used ···sudo apt install openjdk-8-jdk ···, and changed the Project Structure to openjdk-8, and the problem was solved.
Can anyone tell me what is the reason for this?