Build Java development environment with VS Code on Mac


I want to debug a Java project locally In the first place, I was told to include the JDK in order to execute Java on the VS Code command line.


Enable Java development on VS Code


What i did

1. Know the reality

First, open the folder containing the file you want to execute with VS Code Open-folder (It seems that you can also do it with command + O)

Once opened, open the terminal with the following shortcut Shortcut: `` control + shift + ```

Your first location is in an open folder. Anything is fine, so if you want to use Java, hit the command in the terminal. Then, I was told No Java runtime present, requesting install..

Try to check the Java version on your Mac terminal.

$ java -version
No Java runtime present, requesting install.

.. .. .. It's the same result. It was said that Java was not installed on the Mac itself in the first place.

2. Install Java on Mac

Since it was discovered that it was not fundamentally ready, I decided to install Java on the Mac first and then set VS Code.

When I checked the Java version in the terminal earlier, this pop-up appeared. (Although VS Code also appeared) popup-installJava Clicking on this More Info ... will take you to the Java download page of Oracle (developer).

If you are not particular about it, I think the latest version is fine. Click the version of JDK (Java SE Development Kit) that suits your needs. (I chose 8 according to the project I'm joining this time) JavaJDK

Then, you will be taken to the page with a list of download links for each product like this. Links_downloadJDK

This time it is supposed to be used on Mac, so click the download link at macOS x64. Then you will be asked "Are you in agreement with the license agreement?" In a pop-up, so check the check box and start downloading.


Unfortunately, it seems that you have to register an Oracle account to download. ~~ It's annoying ~~ If you already have it, you can just log in, but I didn't have one, so I made it quietly. ~~ Surprisingly, there are many required items and it's annoying s ~~

Click Create Account to open the member registration screen in a separate tab. Leave this login screen as it will come back later.

If you follow the verification link in the confirmation email and successfully create it, return to the login screen, enter your email address and password, and click Sign in to start downloading automatically.

Execute the downloaded dmg file. Double-click the pkg file in the extracted folder. pkg-folder

The installer will start, so follow the instructions to complete the installation.

Confirmation of installation

Make sure that it is really installed. In the terminal, hit the command to check the version as before.

$ java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

It was installed successfully! !! !!

I was worried for a moment because the first number was 1, but it seems to be okay because there is 8 behind it. But from around 11, the beginning is 11. .. ..

*** Digression *** If you wonder what the SE behind Java is, it seems to be an abbreviation for Standard Edition.

3. Check the current status with VS Code (no problem)

Even with VS Code, when I opened the terminal and hit the command in the same way, it turned out that Java works properly. Congratulations.

4. Extension installation

Development can be done as it is, but for further convenience, the extension function is installed. (Face whose details are unknown) Click the Tetris-like block icon on the left side of VS Code. vscode-icons

Type "java" in the search bar and (probably) you will see the Java Extension Pack at the top, install it. java-extension

.. .. .. It's already in. If you haven't installed it yet, the blue ʻUninstall in the center of the screen should be the green ʻInstall, so click on it.

If you use Spring Boot, you may want to install the extension Spring Boot Extension Pack in the same way. ↓ This springboot-extension


Lesson: Before VS Code, let's prepare the development environment of the Mac itself first


[For beginners] How to install Java 11 on Mac-Light Code Co., Ltd.

Recommended Posts

Build Java development environment with VS Code on Mac
Build a Java development environment with VS Code
Java build with mac vs code
Java development environment (Mac, VS Code)
Build Java development environment with WSL2 Docker VS Code
How to build Java development environment with VS Code
[Environment construction] Build a Java development environment with VS Code!
Prepare Java development environment with VS Code
Build a Java development environment on Mac
[Mac] VS Code development environment construction (Java, Gradle, Node.js)
Build Java development environment (for Mac)
Build Java program development environment with Visual Studio Code
Install Java development environment on Mac
Java web application development environment construction with VS Code (struts2)
Build WebAPP development environment with Java + Spring with Visual Studio Code
Java development environment construction memo on Mac
Build Java 8 development environment on AWS Cloud9
Hello World on Mac VS Code Java
[Java] Build Java development environment on Ubuntu & check execution
Using Gradle with VS Code, build Java → run
Java development environment (Mac, Eclipse)
Introduction to Java development environment & Spring Boot application created with VS Code
Create a Java development environment using jenv on Mac
Build VS Code + WSL + Java + Gradle environment from scratch
Build ruby debug environment with VS Code of Windows 10
Java Spring environment in vs Code
Prepare Java development environment with Atom
Build jooby development environment with Eclipse
Build Unity development environment on docker
Build a CentOS 8 virtual environment on your Mac with VirtualBox
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.
Until you build a Nuxt.js development environment with Docker and touch it with VS Code
Laravel development environment construction with Docker (Mac)
Build a PureScript development environment with Docker
[Note] A story about changing Java build tools with VS Code
Java development environment
What is Java and Development Environment (MAC)
Let me do VS Code Remote Development + Java development in Proxy environment
Building a haskell environment with Docker + VS Code on Windows 10 Home
Build a Wordpress development environment with Docker
Build Redmine code reading environment on Docker
[ev3 × Java] leJOS development environment construction (Eclipse on Mac OSX / bluetooth)
Build OpenCV with Java Wrapper on Ubuntu 18.04
Build an environment with Docker on AWS
Build a JMeter environment on your Mac
Build an Ultra96v2 development environment on Docker 1
Steps to build a Ruby on Rails development environment with Vagrant
Build debug environment on container --Build local development environment for Rails tutorial with Docker-
A record of setting up a Java development environment with Visual Studio Code
Creating a java web application development environment with docker for mac part1
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
Build a development environment on AWS EC2 with CentOS7 + Nginx + pm2 + Nuxt.js
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Create a java web application development environment with docker for mac part2
Template: Build a Ruby / Rails development environment with a Docker container (Mac version)
Try to build Java8 environment on Amazon Linux2
Build a WordPress development environment quickly with Docker
Build Apache / Tomcat development environment on Cent OS 7
Build an E2E test environment with Selenium (Java)
[Win10] Build a JSF development environment with NetBeans
[Ruby on Rails] Let's build an environment on mac