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.
If you already have Java, skip to "Insert Java Extensions in VS Code".
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.
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.
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-126.96.36.199.1 (build 11.0.7+10-LTS) OpenJDK 64-Bit Server VM Corretto-188.8.131.52.1 (build 11.0.7+10-LTS, mixed mode)
If you see the installed Java, you are successful.
Launch VSCode and search for
Java in the extension search.
Select Java Extension Pack and install it.
By adding the extension, it is possible to create a Java project.
Open the command palette with
Shift + Command + P and enter Java.
Various commands come out like this.
Java: Create Java Project.
Then, the following will be displayed.
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.
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.
If you select ʻApp.java`, the main method that just outputs the long-desired Hello World will be displayed, so click Run.
The long-awaited Hello World is displayed!