Hello World on Mac VS Code Java

Introduction

As the title says, it's just Hello World. It may be a good way to quickly solve common problems such as standard output. From now on, I'm going to make a web application in this environment! I do not recommend it to people. I think there are other articles about building an environment with IntelliJ IDEA, Eclipse + Pleiades, NetBeans, etc., so please refer to that. I really want to try it with VS Code! I hope that only people can refer to it.

Environment confirmed operation

Method

If you already have Java, skip to "Insert Java Extensions in VS Code".

Install SDKMAN!

SDKMAN! Is simply a tool for managing multiple Javas in the same environment. Let's install SDK MAN! Refer to here. https://sdkman.io/install

If your Mac OS version is Catalina at the time of purchase, change the first curl as follows.

curl -s "https://get.sdkman.io" | zsh

The default shell for Mac from Catalina is zsh. I haven't tried fish, so if you know it, please let me know.

Install your favorite Java with SDKMAN!

First, execute the following command to check the Java that can be installed with SDKMAN !.

sdk list java

Then, the output will be as follows. (As of June 2020) If it is not output, SDKMAN! Has not been installed properly.

================================================================================
Available Java Versions
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 AdoptOpenJDK  |     | 14.0.1.j9    | adpt    |            | 14.0.1.j9-adpt
               |     | 14.0.1.hs    | adpt    |            | 14.0.1.hs-adpt
               |     | 13.0.2.j9    | adpt    |            | 13.0.2.j9-adpt
               |     | 13.0.2.hs    | adpt    |            | 13.0.2.hs-adpt
               |     | 12.0.2.j9    | adpt    |            | 12.0.2.j9-adpt
               |     | 12.0.2.hs    | adpt    |            | 12.0.2.hs-adpt
               |     | 11.0.7.j9    | adpt    |            | 11.0.7.j9-adpt
               |     | 11.0.7.hs    | adpt    |            | 11.0.7.hs-adpt
               |     | 8.0.252.j9   | adpt    |            | 8.0.252.j9-adpt
               |     | 8.0.252.hs   | adpt    |            | 8.0.252.hs-adpt
 Amazon        | >>> | 11.0.7       | amzn    | installed  | 11.0.7-amzn
               |     | 8.0.252      | amzn    |            | 8.0.252-amzn
               |     | 8.0.202      | amzn    |            | 8.0.202-amzn
 Azul Zulu     |     | 14.0.1       | zulu    |            | 14.0.1-zulu
               |     | 13.0.3       | zulu    |            | 13.0.3-zulu
               |     | 13.0.3.fx    | zulu    |            | 13.0.3.fx-zulu
               |     | 12.0.2       | zulu    |            | 12.0.2-zulu
               |     | 11.0.7       | zulu    |            | 11.0.7-zulu
               |     | 11.0.7.fx    | zulu    |            | 11.0.7.fx-zulu
               |     | 10.0.2       | zulu    |            | 10.0.2-zulu
               |     | 9.0.7        | zulu    |            | 9.0.7-zulu
               |     | 8.0.252      | zulu    |            | 8.0.252-zulu
               |     | 8.0.252.fx   | zulu    |            | 8.0.252.fx-zulu
               |     | 8.0.232.fx   | zulu    |            | 8.0.232.fx-zulu
               |     | 8.0.202      | zulu    |            | 8.0.202-zulu
               |     | 7.0.262      | zulu    |            | 7.0.262-zulu
               |     | 7.0.181      | zulu    |            | 7.0.181-zulu
 BellSoft      |     | 14.0.1.fx    | librca  |            | 14.0.1.fx-librca
               |     | 14.0.1       | librca  |            | 14.0.1-librca
               |     | 13.0.2.fx    | librca  |            | 13.0.2.fx-librca
               |     | 13.0.2       | librca  |            | 13.0.2-librca
               |     | 12.0.2       | librca  |            | 12.0.2-librca
               |     | 11.0.7.fx    | librca  |            | 11.0.7.fx-librca
               |     | 11.0.7       | librca  |            | 11.0.7-librca
               |     | 8.0.252.fx   | librca  |            | 8.0.252.fx-librca
               |     | 8.0.252      | librca  |            | 8.0.252-librca
 GraalVM       |     | 20.1.0.r11   | grl     |            | 20.1.0.r11-grl
               |     | 20.1.0.r8    | grl     |            | 20.1.0.r8-grl
               |     | 20.0.0.r11   | grl     |            | 20.0.0.r11-grl
               |     | 20.0.0.r8    | grl     |            | 20.0.0.r8-grl
               |     | 19.3.1.r11   | grl     |            | 19.3.1.r11-grl
               |     | 19.3.1.r8    | grl     |            | 19.3.1.r8-grl
 Java.net      |     | 15.ea.26     | open    |            | 15.ea.26-open
               |     | 14.0.1       | open    |            | 14.0.1-open
               |     | 13.0.2       | open    |            | 13.0.2-open
               |     | 12.0.2       | open    |            | 12.0.2-open
               |     | 11.0.2       | open    |            | 11.0.2-open
               |     | 10.0.2       | open    |            | 10.0.2-open
               |     | 9.0.4        | open    |            | 9.0.4-open
 SAP           |     | 14.0.1       | sapmchn |            | 14.0.1-sapmchn
               |     | 13.0.2       | sapmchn |            | 13.0.2-sapmchn
               |     | 12.0.2       | sapmchn |            | 12.0.2-sapmchn
               |     | 11.0.7       | sapmchn |            | 11.0.7-sapmchn
================================================================================
Use the Identifier for installation:

    $ sdk install java 11.0.3.hs-adpt
================================================================================

I have Amazon Corretto 11.0.7 installed, so it's installed. The following is an example of installing Corretto. Change 11.0.7-amzn to your favorite Identifier.

$ sdk install java 11.0.7-amzn

Now let's make sure Java is installed properly!

$ java --version
openjdk 11.0.7 2020-04-14 LTS
OpenJDK Runtime Environment Corretto-11.0.7.10.1 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.7.10.1 (build 11.0.7+10-LTS, mixed mode)

If you see the installed Java, you are successful.

Put Java extensions in VS Code

Launch VSCode and search for Java in the extension search. Select Java Extension Pack and install it.

Create a Java project

By adding the extension, it is possible to create a Java project. Open the command palette with Shift + Command + P and enter Java. スクリーンショット 2020-06-10 23.14.57.png Various commands come out like this. Select Java: Create Java Project. Then, the following will be displayed. スクリーンショット 2020-06-10 23.19.58.png In this article, I'm only thinking about putting out Hello World, so I'll select No build tools for the time being. You will be asked where to make it, so make it in your favorite directory with your favorite name. Then, the following will be displayed at the bottom right of the screen. スクリーンショット 2020-06-10 23.19.27.png As I say many times, I'm just doing Hello World, so please select Never for the time being. Then, the project will be created with such a configuration. スクリーンショット 2020-06-10 23.40.24.png If you select ʻApp.java`, the main method that just outputs the long-desired Hello World will be displayed, so click Run. スクリーンショット 2020-06-10 23.43.45.png

The long-awaited Hello World is displayed!

Recommended Posts

Hello World on Mac VS Code Java
Hello World with VS Code!
Build Java development environment with VS Code on Mac
Java build with mac vs code
Java development environment (Mac, VS Code)
Java, Hello, world!
Java Hello World
"Hello World" in Java
Install Java on Mac
Java Learning (1)-Hello World
Hello World in Java
Hello World on WebAssembly
[Mac] Install Java in Visual Studio Code (VS Code)
Run VS Code on Docker
[Mac] VS Code development environment construction (Java, Gradle, Node.js)
java hello world, compile, run
Java beginners read Hello World
Try Hello World using plain Java on a Docker container
Java Spring environment in vs Code
Java 15 implementation and VS Code preferences
Hello World for ImageJ Java Plugin
Install Java development environment on Mac
Hello world in Java and Gradle
Open VS Code Remote Containers directly from the CLI on Mac
Until you run Hello World of JavaFX with VS Code + Gradle
Java 10 (JDK 10) was released on March 20, 2018, so let's try Hello World.
How to check Java installed on Mac
Prepare Java development environment with VS Code
Java development environment construction memo on Mac
Hello world with Java template engine Thymeleaf
How to switch Java versions on Mac
Build a Java development environment on Mac
Java development with Codenvy: Hello World! Run
Execute Java code stored on the clipboard.
[Mac] Install Java in Visual Studio Code
Minimal Java environment construction and Hello World
Install java and android-sdk on Mac using homebrew
Script Java code
I tried putting Java on my Mac easily
Put Java 11 and spring tool suite on mac
Java code TIPS
Next.js + Rails (API) + Mysql on Docker's Hello World!
Java sample code 02
Java sample code 03
Build Java environment and output hello world [Beginner]
Read "Hello world"
Java sample code 04
Run JSP Hello World with Tomcat on Docker
Using Gradle with VS Code, build Java → run
Switch between multiple versions of Java on Mac
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~
Display "Hello World" in the browser using Java
Hello Java Lambda
Display "Hello World" in the browser using Java
Hello World, a cross-platform GUI app with Groovy running on the Java platform
Java sample code 01
Java character code
Try debugging a Java program with VS Code
Wastefully creative "Hello World" output method list (Java)
I tried running Java on a Mac terminal
Build a Java development environment with VS Code