Reputation: 12790
When I open VSCode a tab shows the following:
# Path
1 ~/programs/jdk-12.0.1 CurrentInvalid
JDK 8+ is required while the path is pointing to version 0
The terminal shows the version:
$ javac -version
javac 12.0.1
$ echo $JAVA_HOME
/home/stephane/programs/jdk-12.0.1
$ whereis javac
javac: /home/stephane/programs/jdk1.12.0.1/bin/javac
The .profile file contains:
export JAVA_HOME=$HOME/programs/jdk-12.0.1
export JAVA_PATH=$JAVA_HOME
export JAVA_OPTS=""
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin
I tried renaming the directory to jdk1.12.0.1
but it changed nothing to the error:
1 ~/programs/jdk1.12.0.1 CurrentInvalid
JDK 8+ is required while the path is pointing to version 0
Why is VSCode 1.38.1
on Ubuntu 16.04
not accepting my Java version ?
Upvotes: 4
Views: 1249
Reputation: 12790
I changed the SDK to jdk-11.0.5
and still had the exact same issue.
The settings could not find it in ~/programs/jdk-11.0.5
too.
Only when I replaced the ~
with the absolute path as in /home/stephane/programs/jdk-11.0.5
and closed and restarted the editor, did it work.
Note too that the suggested restart with the editor notification seemed not to update the settings change. I had to close the editor and open it again for the settings change to be seen by the editor.
Upvotes: 2