How to build Java development environment with VS Code

It's surprisingly easy to build an environment with VS Code ♪ I was a little addicted to it. But the result was easy

Finally, I will summarize a little about the points I was addicted to and how to deal with them.

Development environment

OS : Windows10 VSCode : Version 1.41.1

procedure

--JDK installation --Java Extension Pack installation --Pass the path to the JDK in Java.home

First, install the JDK (Java SE Development Kit)

Access the JDK Download Page

Java SE Development Kit ~ ○ Click Accept License Agreement image.png

After that, you will be able to download the JDK files, so This time, download dk-8u231-windows-x64.exe for Windows x64.

image.png

You will then be asked to sign in to your Oracle profile, sign in and the download will begin. If you do not have an account, you can create a new one. image.png

For subsequent installations, follow the on-screen instructions and leave the default settings (without changing the settings).

Next, install the extension Java Extension Pack from VS Code.

From the shortcut key of Cntl + Shift + x keys on VSCode or the setting icon at the bottom left of the window Select Extensions

image.png

Then a list of extensions will be displayed, so type "java extension pack" in the search form. Click the "Java Extension Pack ~" install button displayed at the top to install.

image.png

Wait a moment, and if VS Code shows something like this, the installation is complete. image.png

Finally, write java.home and pass the path to the JDK

Open it with the shortcut key of Cntl +, (comma) key, or open the setting screen with the setting icon → [Setting] at the bottom left of the screen. image.png

The setting screen is displayed like this. image.png

Enter "java.home" in the search form at the top of the screen. image.png

Click on the part that says ʻEdit in settings.json`, The json file will open, so

{
    "java.home": "C:\\Program Files\\Java\\jdk1.8.0_231"
}

Enter according to the installed version.

In my case, some were mentioned at the beginning, so I added them at the end. (Because the json file needs to be separated by',' (comma) for each item, don't forget to enter',' just before java.home)

python


{
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "java.home": "C:\\Program Files\\Java\\jdk1.8.0_231"
}

This completes the settings. If you close VS Code and reopen it, the development environment construction is complete!

After rebooting, type "create java project" with Cntl + Shift + p and press enter, and if the file system starts up, it's okay. image.png

A little addicted to building the environment

VS Code crashes at startup An alert appears at the bottom right of VS Code "Extension host terminated unexpectedly." Is displayed in the alert When I opened the detection tool and confirmed the error, "onDidNotificationChange @ notificationsAlerts.ts:40" was displayed.

It seems that the cause was that the path of the json file was not described correctly. After fixing it, it worked fine. It's a general mistake, but it is said that the file "JRE", which is similar to the "JDK" file, was specified as the path. .. ..

If you don't get a direct error, it's difficult to understand the cause, so if you get hooked on building an environment A small mistake will take a lot of time.

If the above does not resolve the symptom, uninstall all Java related extensions once. You may want to try again!

I hope you find this article useful.

Reference site https://www.suzu6.net/posts/130-vscode-for-java/

Recommended Posts

How to build Java development environment with VS Code
Build a Java development environment with VS Code
Build Java development environment with VS Code on Mac
Build Java development environment with WSL2 Docker VS Code
[Environment construction] Build a Java development environment with VS Code!
Java development environment (Mac, VS Code)
Build Java program development environment with Visual Studio Code
Introduction to Java development environment & Spring Boot application created with VS Code
Java web application development environment construction with VS Code (struts2)
How to build Rails, Postgres, ElasticSearch development environment with Docker
Build WebAPP development environment with Java + Spring with Visual Studio Code
How to build Rails 6 environment with Docker
Using Gradle with VS Code, build Java → run
[Rails] How to build an environment with Docker
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Build VS Code + WSL + Java + Gradle environment from scratch
How to build docker environment with Gradle for intelliJ
[Mac] VS Code development environment construction (Java, Gradle, Node.js)
Build ruby debug environment with VS Code of Windows 10
Try to build a Java development environment using Docker
Java Spring environment in vs Code
Prepare Java development environment with Atom
Build Java development environment (for Mac)
Build jooby development environment with Eclipse
I tried to create a java8 development environment with Chocolatey
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Express ~
What happened in "Java 8 to Java 11" and how to build an environment
A memo to start Java programming with VS Code (2020-04 version)
Until you build a Nuxt.js development environment with Docker and touch it with VS Code
[Rails] [Docker] Copy and paste is OK! How to build a Rails development environment with Docker
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
[Java] How to compare with equals method
Build a PureScript development environment with Docker
[Note] A story about changing Java build tools with VS Code
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ MySQL edition ~
Java development environment
Settings to delete unused Java imports when saving with VS Code
How to install Pry after building Rails development environment with Docker
Let me do VS Code Remote Development + Java development in Proxy environment
Build Java 8 development environment on AWS Cloud9
Build a Wordpress development environment with Docker
How to open a script file from Ubuntu with VS code
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
How to resolve VS Code "Build failed, do you want to continue?"
Steps to build a Ruby on Rails development environment with Vagrant
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Sequelize ~
A record of setting up a Java development environment with Visual Studio Code
How to execute with commands of normal development language in Docker development environment
I tried to build a Firebase application development environment with Docker in 2020
Try to build Java8 environment on Amazon Linux2
Java Development Basics ~ How to Write Programs * Exercise 1 ~
How to use Java framework with AWS Lambda! ??
Build an E2E test environment with Selenium (Java)
How to use Java API with lambda expression
Rails6.0 ~ How to create an eco-friendly development environment
[Win10] Build a JSF development environment with NetBeans
How to write test code with Basic authentication
How to build API with GraphQL and Rails
Create Spring Boot environment with Windows + VS Code
Build a development environment for Docker, java, vscode