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
First, open the folder containing the file you want to execute with VS Code (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.
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)
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)
Then, you will be taken to the page with a list of download links for each product like this.
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.
The installer will start, so follow the instructions to complete the 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.
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.
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.
Type "java" in the search bar and (probably) you will see the Java Extension Pack
at the top, install it.
.. .. .. 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
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