如何在 Ubuntu for Visual Studio Code 中为 JDK 11 设置 JAVA_HOME?
sudo apt-get install openjdk-11-jdk
sudo update-alternatives --config java
Obs.: It will returns you a path like this:
/usr/lib/jvm/java-11-openjdk-amd64/bin/java (copy this path)
sudo gedit ~/.bashrc
The code above will open the file, insert JAVA_HOME in the end of this, be careful, do not change anything here, just adding this code and SAVE:
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME
Obs.: JAVA_HOME= **put your java path without "/bin/java" here **
-press F1 and type Sttings Sync: Show Settings
-inside serarch settings put @tag:sync
-find and open settings.json like this:
-now you just need to put your JAVA_HOME like this:
"java.home": "/usr/lib/jvm/java-11-openjdk-amd64",
"java.configuration.runtimes": [
{
"name":"JavaSE-11",
"path": "/usr/lib/jvm/java-11-openjdk-amd64"
}
],
reload vscode window, or just close it and open agin
...and VOALA ! now the JDK is visible * -- *
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.