search
HomeDevelopment ToolsVSCodeTeach you step by step how to set up a Java environment in VSCode

This article will give you a detailed understanding of how to build a Java environment in VSCode. I hope it will be helpful to friends in need!

Teach you step by step how to set up a Java environment in VSCode

1. Software installation

visual studio code download link: https://azure.microsoft.com/zh-cn/products/visual-studio -code/

JDK official website download address: https://www.oracle.com/cn/java/technologies/javase-jdk15-downloads.html

Teach you step by step how to set up a Java environment in VSCode
Specific Which one to choose according to your own computer system:
installer version:
Installer, execute the exe file to install.

binary is the same as archive:
Binary package is a compiled program that can be used directly. After decompression, click the .sh or .bat executable file in the bin directory to use it.

2. Add environment variables

Tips: Add environment variables: Right-click My Computer –> Advanced System Settings –> Environment Variables –> Select User Variables and System variables can be used, double-click path to add the path –> OK

Find the JDK installation path, find the location as shown below
Teach you step by step how to set up a Java environment in VSCode
Add environment variables such as mine :F:\jdk_13.0.2\bin
Teach you step by step how to set up a Java environment in VSCode
In addition, create two more environment variables, the variable names are CLASSPATH and JAVA_HOME respectively, the file paths are slightly different:
CLASSPATH:
Teach you step by step how to set up a Java environment in VSCode
JAVA_HOME:
Teach you step by step how to set up a Java environment in VSCode

##3. vscode configuration

1. Software itself settings

Install the Chinese package: Search Chinese in the software store on the left column and select to install the Chinese package:


Teach you step by step how to set up a Java environment in VSCode Identify the encoding: Click on the settings in the lower left corner, search for Auto Guess Encoding in the search bar, and check the box. The character encoding format can be automatically guessed when reading code to correctly display information such as comments.

Teach you step by step how to set up a Java environment in VSCode
If this is the first time you browse this language, a box will pop up in the lower right corner to prompt you to install an expansion pack to identify the code. Just install it. Of course, you can also go to the app store on the left column. Search and install

2. Compilation environment configuration

Create launch.json:


Teach you step by step how to set up a Java environment in VSCode After creation, you can run it in the code interface:

Teach you step by step how to set up a Java environment in VSCode Or click Run directly:

Teach you step by step how to set up a Java environment in VSCode

Postscript

vscode is more suitable for writing small project code. If it is a large project, you still need to use that one More professional software, such as eclipse. I made a small game at the time, which was a project built using eclipse. It is also easier to find bugs. You can also add libraries, such as jl-1.0.1.jar, and I don’t know how to use vscode. After adding libraries and setting up the project, I often write about bugs that cannot be found. It is more comfortable for me to continue to use vscode to write, and debugging is also more convenient.

Attached is a small game I wrote. Due to the path problem, I can only put it on the desktop and run it and cannot change the folder name. It should be able to be changed in the .classpath file. Let’s see if it can run. It’s fate (^_−)☆.


Teach you step by step how to set up a Java environment in VSCode

Network disk link:

Link: https://pan.baidu.com/s/1cK6brC3dcnTuJ91jlWe9eA
Extraction code: 9x3b

For more knowledge about VSCode, please visit:

vscode tutorial! !

The above is the detailed content of Teach you step by step how to set up a Java environment in VSCode. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete
Choosing Between Visual Studio and VS Code: The Right Tool for YouChoosing Between Visual Studio and VS Code: The Right Tool for YouMay 09, 2025 am 12:21 AM

VisualStudio is suitable for large projects, VSCode is suitable for projects of all sizes. 1. VisualStudio provides comprehensive IDE functions, supports multiple languages, integrated debugging and testing tools. 2.VSCode is a lightweight editor that supports multiple languages ​​through extension, has a simple interface and fast startup.

Visual Studio: A Powerful Tool for DevelopersVisual Studio: A Powerful Tool for DevelopersMay 08, 2025 am 12:19 AM

VisualStudio is a powerful IDE developed by Microsoft, supporting multiple programming languages ​​and platforms. Its core advantages include: 1. Intelligent code prompts and debugging functions, 2. Integrated development, debugging, testing and version control, 3. Extended functions through plug-ins, 4. Provide performance optimization and best practice tools to help developers improve efficiency and code quality.

Visual Studio vs. VS Code: Pricing, Licensing, and AvailabilityVisual Studio vs. VS Code: Pricing, Licensing, and AvailabilityMay 07, 2025 am 12:11 AM

The differences in pricing, licensing and availability of VisualStudio and VSCode are as follows: 1. Pricing: VSCode is completely free, while VisualStudio offers free community and paid enterprise versions. 2. License: VSCode uses a flexible MIT license, and the license of VisualStudio varies according to the version. 3. Usability: VSCode is supported across platforms, while VisualStudio performs best on Windows.

Visual Studio: From Code to ProductionVisual Studio: From Code to ProductionMay 06, 2025 am 12:10 AM

VisualStudio supports the entire process from code writing to production deployment. 1) Code writing: Provides intelligent code completion and reconstruction functions. 2) Debugging and testing: Integrate powerful debugging tools and unit testing framework. 3) Version control: seamlessly integrate with Git to simplify code management. 4) Deployment and Release: Supports multiple deployment options to simplify the application release process.

Visual Studio: A Look at the Licensing LandscapeVisual Studio: A Look at the Licensing LandscapeMay 05, 2025 am 12:17 AM

VisualStudio offers three license types: Community, Professional and Enterprise. The Community Edition is free, suitable for individual developers and small teams; the Professional Edition is annually subscribed, suitable for professional developers who need more functions; the Enterprise Edition is the highest price, suitable for large teams and enterprises. When selecting a license, project size, budget and teamwork needs should be considered.

The Ultimate Showdown: Visual Studio vs. VS CodeThe Ultimate Showdown: Visual Studio vs. VS CodeMay 04, 2025 am 12:01 AM

VisualStudio is suitable for large-scale project development, while VSCode is suitable for projects of all sizes. 1. VisualStudio provides comprehensive development tools, such as integrated debugger, version control and testing tools. 2.VSCode is known for its scalability, cross-platform and fast launch, and is suitable for fast editing and small project development.

Visual Studio vs. VS Code: Comparing the Two IDEsVisual Studio vs. VS Code: Comparing the Two IDEsMay 03, 2025 am 12:04 AM

VisualStudio is suitable for large projects and Windows development, while VSCode is suitable for cross-platform and small projects. 1. VisualStudio provides a full-featured IDE, supports .NET framework and powerful debugging tools. 2.VSCode is a lightweight editor that emphasizes flexibility and extensibility, and is suitable for various development scenarios.

Visual Studio: Comparing Free and Paid OptionsVisual Studio: Comparing Free and Paid OptionsMay 02, 2025 am 12:09 AM

When choosing VisualStudio, the free version is suitable for individual developers and small teams, and the paid version is suitable for large enterprises and users who need advanced features. 1. The free CommunityEdition provides basic development tools for individuals and small teams. 2. Paid Professional and Enterprise Editions provide advanced features and support for business environments and large teams.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool