search
HomeDevelopment ToolsVSCodevscode builds java development environment

vscode builds java development environment

Dec 17, 2019 am 09:21 AM
javavscodedevelopment environmentbuild

vscode builds java development environment

Environment: The system needs to install jdk1.8, configure the environment variable JAVA_HOME

Open vscode, install java related plug-ins

Language support for Java ™ for Visual Studio Code

Java Extension Pack

Debugger for Java

Java Test Runner

After the above plug-ins are installed, you can start java development.

Personally recommended plug-in

Eclipse Keymap for Visual Studio Code. (eclipse shortcut keys, favorite of eclipse users)

Lombok Annotations Support for VS Code. (Simplified POJO, very pleasant surprise)

Develop basic configuration

Common configuration items: File->Preferences->Settings

1 , maven configuration (if maven is installed locally)

"java.configuration.maven.userSettings": "/home/luokai/maven/apache-maven-3.3.9/conf/settings.xml"

It is recommended to use maven Ali warehouse: add ## in settings.xml #

<mirrors>
    <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>

2. Global search ignores folders, and you often need to ignore target files when searching for files.


"search.exclude": {
            "**/node_modules": true,
            "**/bower_components": true,
            "**/target": true,
            "**/logs": true
        }

3. Junit testing, there are problems with the Java Test Runner plug-in running multi-module project tests

GitHub issues have now been resolved: ), in version 0.7.1

recommend a cumbersome way: rely on maven

tasks-> configure tasks

in the tasks array Add the following configuration:

"tasks": [
    {
        "label": "test:HelloWorld",
        "type": "shell",
        "command": "mvn -Dtest=HelloWorldTest#testHelloWorld test",
        "group": "test"
    },

Execute test:command: Run the specified unit test, HelloWorldTest.testHelloWorld() method

Task->Run task

Select just added The test case works perfectly.

4. Use tomcat to debug web projects

(1) Install the Tomcat for Java plug-in

(2) Click the right number of TOMCAT SERVERS in the sidebar and select the locally installed tomcat

(3) Select the war package to run.

PS: Pay attention to building the latest war package before debugging

Tips:

Cancel clicking to open the file to cover the navigation bar:

File->Preferences->Settings, add "workbench.editor.enablePreview": false,

Related article tutorial recommendations:

vscode tutorial

The above is the detailed content of vscode builds java development environment. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Is Visual Studio Still Free? Understanding the AvailabilityIs Visual Studio Still Free? Understanding the AvailabilityApr 18, 2025 am 12:05 AM

Yes, some versions of VisualStudio are free. Specifically, VisualStudioCommunityEdition is free for individual developers, open source projects, academic research, and small organizations. However, there are also paid versions such as VisualStudioProfessional and Enterprise, suitable for large teams and enterprises, providing additional features.

Using Visual Studio: Developing Software Across PlatformsUsing Visual Studio: Developing Software Across PlatformsApr 17, 2025 am 12:13 AM

Cross-platform development with VisualStudio is feasible, and by supporting frameworks like .NETCore and Xamarin, developers can write code at once and run on multiple operating systems. 1) Create .NETCore projects and use their cross-platform capabilities, 2) Use Xamarin for mobile application development, 3) Use asynchronous programming and code reuse to optimize performance to ensure efficient operation and maintainability of applications.

How to format json with vscodeHow to format json with vscodeApr 16, 2025 am 07:54 AM

The ways to format JSON in VS Code are: 1. Use shortcut keys (Windows/Linux: Ctrl Shift I; macOS: Cmd Shift I); 2. Go through the menu ("Edit" > "Format Document"); 3. Install JSON formatter extensions (such as Prettier); 4. Format manually (use shortcut keys to indent/extract blocks or add braces and semicolons); 5. Use external tools (such as JSONLint and JSON Formatter).

How to compile vscodeHow to compile vscodeApr 16, 2025 am 07:51 AM

Compiling code in VSCode is divided into 5 steps: Install the C extension; create the "main.cpp" file in the project folder; configure the compiler (such as MinGW); compile the code with the shortcut key ("Ctrl Shift B") or the "Build" button; run the compiled program with the shortcut key ("F5") or the "Run" button.

How to install vscodeHow to install vscodeApr 16, 2025 am 07:48 AM

To install Visual Studio Code, please follow the following steps: Visit the official website https://code.visualstudio.com/; download the installer according to the operating system; run the installer; accept the license agreement and select the installation path; VSCode will start automatically after the installation is completed.

How to enlarge fonts with vscodeHow to enlarge fonts with vscodeApr 16, 2025 am 07:45 AM

The methods to enlarge fonts in Visual Studio Code are: open the settings panel (Ctrl, or Cmd,). Search and adjust "Font Size". Choose "Font Family" with the right size. Install or select a theme that provides the right size. Use keyboard shortcuts (Ctrl or Cmd) to enlarge the font.

How to connect to a remote server with vscodeHow to connect to a remote server with vscodeApr 16, 2025 am 07:42 AM

How to connect to a remote server through VSCode? Install Remote - SSH Extended Configuration SSH Create a Connection in VSCode Enter connection information: Host, Username, Port, SSH Key Double-click the saved connection in Remote Explorer

How to run vue with vscodeHow to run vue with vscodeApr 16, 2025 am 07:39 AM

Running a Vue project in VSCode requires the following steps: 1. Install the Vue CLI; 2. Create a Vue project; 3. Switch to the project directory; 4. Install project dependencies; 5. Run the development server; 6. Open the browser to visit http://localhost:8080.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools