[Java] [Mac] Install Java on Visual Studio Code (VS Code)

less than 1 minute read

Introduction

The environment I went this time is as follows

OS: MacOS Catalina (version 10.15.4)
Java: 14

Install Java

Install “Java Extension Pack” by extension. Execute the following command in VS Code to display the extension installation screen. “Command + Shift + x”

Enter “java” on the search screen and select “Java Extension Pack” to install Screenshot 2020-06-01 22.06.44.png

If ↓ screen is displayed as a result of installation, select “Download manually”

Screenshot 2020-06-01 22.10.14.png

When downloaded manually, ↓Installation complete is displayed. Screenshot 2020-06-01 22.11.58.png

Install JDK

Download the JDK from the following site and install (version 14 this time) https://www.oracle.com/java/technologies/javase-jdk14-downloads.html  Screenshot 2020-06-02 22.10.10.png

Through #Path If the Java path does not pass, JAVA_HOME must be set. Execute the following command in the terminal to check the current JAVA_HOME.

/usr/libexec/java_home

Copy the execution result, open the VS Code setting screen and search for “java home”. Screenshots 2020-06-02 22.23.30.png

Select “Edit with settings.json” and paste it below “java.home”  Screenshot 2020-06-02 22.25.01.png

Operation check

Enter appropriate sample code and execute debug Screenshot 2020-06-02 22.28.40.png