

In Ubuntu, the default JDK installation location is “/usr/lib/jvm/java-1.17.0-openjdk-amd64”. In the same terminal, run the following command: export JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64 The Windows JDK installer can automatically set the environment variables, but in Ubuntu, we have to manually set them up. OpenJDK 17 is an LTS version of Java JDK and is recommended for software development.Īfter OpenJDK-17 is installed, we need to set up the environment variables such as JAVA_HOME and PATH so that VS Code can locate the Java JDK to run Java code. In Ubuntu, launch a terminal window then run the following command: sudo apt install openjdk-17-jdk You will see a window as shown in the following screenshot:īut you are not limited to the list above, for example, in this post I will show you how to install the prebuilt OpenJDK in Ubuntu 22.04 LTS and how to configure it to work with VS Code. Click View and choose Command Palette (or Ctrl + Shift + P), then type in Install New Java and click the first entry in the search list. Install a Java JDKĪfter installing Extension Pack for Java, you will need to install a Java JDK. Install Extension Pack for JavaĪfter VS Code is installed, click the Extensions icon on the left, then type “Java” in the search box and install Extension Pack for Java. If you use VS Code in Ubuntu, you will need to do some extra work to set up VS Code. In Windows, it is quite easy to set up VS Code for Java development so I will not cover it here.



Visual Studio Code is the most popular open-source, cross-platform IDE for software developers and it supports various programming languages, such as C++, C#, Python, Java, and more.
