Wayback Machine
295 captures
10 Mar 2018 - 06 Feb 2026
May JUN Jul
07
2019 2020 2021
success
fail
About this capture
COLLECTED BY
Organization: Internet Archive
The Internet Archive discovers and captures web pages through many different web crawls. At any given time several distinct crawls are running, some for months, and some every day or longer. View the web archive through the Wayback Machine.
Collection: Live Web Proxy Crawls
Content crawled via the Wayback Machine Live Proxy mostly by the Save Page Now feature on web.archive.org.

Liveweb proxy is a component of Internet Archive’s wayback machine project. The liveweb proxy captures the content of a web page in real time, archives it into a ARC or WARC file and returns the ARC/WARC record back to the wayback machine to process. The recorded ARC/WARC file becomes part of the wayback machine in due course of time.
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20200607220516/https://code.visualstudio.com/docs/java/java-tutorial
This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Learn more
Skip to content 
Visual Studio Code
  • Docs
  • Updates
  • Blog
  • API
  • Extensions
  • FAQ
  • Search
  • Search Search
  • Download VS Code Download VS Code Download

Version 1.45 is now available! Read about the new features and fixes from April.

Dismiss this update
'; document.body.appendChild(div.children[0]); }
  • Overview
  • Setup
    • Overview
    • Linux
    • macOS
    • Windows
    • Network
    • Additional Components
  • Get Started
    • Intro Videos
    • Tips and Tricks
    • User Interface
    • Themes
    • Settings
    • Key Bindings
    • Display Language
    • Telemetry
  • User Guide
    • Basic Editing
    • Extension Marketplace
    • IntelliSense
    • Code Navigation
    • Refactoring
    • Debugging
    • Version Control
    • Working with GitHub
    • Integrated Terminal
    • Tasks
    • Settings Sync
    • Snippets
    • Emmet
    • Command Line
    • Multi-root Workspaces
    • Accessibility
  • Languages
    • Overview
    • JavaScript
    • JSON
    • HTML
    • CSS, SCSS and Less
    • TypeScript
    • Markdown
    • PowerShell
    • C++
    • Java
    • PHP
    • Python
    • Go
    • T-SQL
    • C#
    • .NET Core
  • Node.js / JavaScript
    • Working with JavaScript
    • Node.js Tutorial
    • Node.js Debugging
    • Node.js Deployment
    • React Tutorial
    • Angular Tutorial
    • Vue Tutorial
    • Ember Tutorial
    • Debugging Recipes
    • Extensions
  • TypeScript
    • Tutorial
    • Compiling
    • Debugging
  • Python
    • Tutorial
    • Editing Code
    • Linting
    • Debugging
    • Environments
    • Testing
    • Jupyter Notebook Support
    • Python Interactive
    • Data Science Tutorial
    • Django Tutorial
    • Flask Tutorial
    • Create containers
    • Python on Azure
    • Settings Reference
  • Java
    • Getting Started
    • Navigate and Edit
    • Refactoring
    • Linting
    • Project Management
    • Build Tools
    • Run and Debug
    • Testing
    • Spring Boot
    • Application Servers
    • Java on Azure
    • Extensions
    • FAQ
  • C++
    • GCC on Linux
    • Clang on macOS
    • GCC on Windows
    • Microsoft C++ on Windows
    • GCC on Windows Subsystem for Linux
    • Debugging
    • Editing
    • Settings
    • Configure IntelliSense for cross-compiling
    • FAQ
  • Containers
    • Overview
    • Node.js
    • Python
    • ASP.NET Core
    • Debug
    • Docker Compose
    • Registries
    • Deploy to Azure
    • Choose a dev environment
    • Customize
  • Azure
    • Extensions
    • Deployment
    • Remote Debugging for Node.js
    • Docker
    • MongoDB
    • Kubernetes
    • Try Azure App Service
  • Remote
    • Overview
    • SSH
    • Containers
    • Visual Studio Codespaces
    • Windows Subsystem for Linux
    • Tutorials
    • Tips and Tricks
    • Advanced Containers
    • Linux Prerequisites
    • FAQ

Topics

Getting Started with Java in VS Code

This tutorial shows you how to write and run Hello World program in Java with Visual Studio Code. It also covers a few advanced features, which you can explore by reading other documents in this section.

For an overview of the features available for Java in VS Code, see Java Language Overview

If you run into any issues when following this tutorial, you can contact us by clicking the Report an issue button below.

Report an issue

If you need to install VS Code, download it here.

Supported Java versions

VS Code works with all major versions of Java SE up to 14.

Setting up Visual Studio Code for Java Development

Installing a Java Development Kit (JDK)

Before going through this tutorial, your development environment must have a Java SE Development Kit (JDK) installed. If it doesn't, you can download and install a JDK from one of these sources:

  • Oracle Java SE
  • AdoptOpenJDK
  • Azul Zulu for Azure - Enterprise Edition

Configuring your development environment to use a JDK

Your development environment needs to know where the JDK is located. A common way to do this is setting the value of the JAVA_HOME system environment variable to the install location of the JDK, for example, C:\Program Files\Java\jdk-13.0.2. Or if you want to configure only VS Code to use the JDK, use the java.home setting in VS Code's User or Workspace settings.

To help you get started quickly, there is a special Installer of Visual Studio Code for Java developers.

Note: The installer is currently only available for Windows. For other operating systems, you will need to manually install a JDK, VS Code, and Java extensions. We're working on the macOS version. Please stay tuned.

The package can be used as a clean install, or you can also use it to update an existing development environment to add Java or VS Code. After you've downloaded and opened it, the installer automatically tries to detect a JDK, VS Code, and essential Java extensions. During install, it downloads the stable versions of those tools from trusted online sources then installs and configures them.

Detect Environment

You can also add Java support to VS Code by installing the popular Microsoft Java Extension Pack, which includes these extensions:

  • Language Support for Java(TM) by Red Hat
  • Debugger for Java
  • Java Test Runner
  • Maven for Java
  • Java Dependency Viewer

Install the Java Extension Pack

You can also select which extensions you would like to install separately. For this tutorial, the only required extensions are

  • Language Support for Java(TM) by Red Hat
  • Debugger for Java

If a JDK is not already installed, the Java Extension Pack provides links to download a reliable JDK.

Settings for the JDK

To access various settings for using the JDK, bring up the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and use the command Java: Configure Java Runtime.

JDK Configuration

The Java Extension Pack, also provides a Quick Start guide and tips for code editing and debugging. It also has a FAQ that answers some frequently asked questions. Use the command Java: Getting Started from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)).

Java Getting Started

Note: To configure multiple JDKs, see Configure JDK. To enable Java preview features, see How can I use VS Code with new Java versions

Creating a source code file

Create a folder for your Java program and open the folder with VS Code. Then in VS Code, create a new file and save it with the name Hello.java. When you open that file, the Java Language Server automatically starts loading, and you should see a loading icon on the right side of the Status Bar. After it finishes loading, you will see a thumbs-up icon.

Note: If you open a Java file in VS Code without opening its folder, the Java Language Server might not work properly.

VS Code will also try to figure out the correct package for the new type and fill the new file from a template. See Create new file.

You can also create a Java project using the Java: Create Java Project command. Bring up the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and then type java to search for this command. After selecting the command, you will be prompted for the location and name of the project. You can also choose your build tool from this command.

Visual Studio Code also supports more complex Java projects, see Project Management.

Editing source code

You can use code snippets to scaffold your classes and methods. VS Code also provides IntelliSense for code completion, and various refactor methods.

To learn more about editing Java, see Java Editing.

Running and debugging your program

To run and debug Java code, set a breakpoint, then either press F5 on your keyboard or use the Run > Start Debugging menu item. You can also use the Run|Debug CodeLens options in the editor. After the code compiles, you can see all your variables and threads in the Run view.

The debugger also supports advanced features such as Hot Code replacement and conditional breakpoints.

For more information, see Java Debugging.

More features

The editor also has much more capability for your Java workload.

  • Editing Java explains how to navigate and edit Java in more details
  • Debugging illustrates all the key features of the Java Debugger
  • Testing provides comprehensive support for JUnit and TestNG framework
  • Java Project Management shows you how to use a project view and work with Maven
  • Spring Boot and Tomcat and Jetty demonstrate great framework support
  • Java Web Apps shows how to work with Java Web App in VS Code
7/25/2019

In this article there are 7 sectionsIn this article

  • Supported Java versions
  • Setting up Visual Studio Code for Java Development
  • Settings for the JDK
  • Creating a source code file
  • Editing source code
  • Running and debugging your program
  • More features
  • Hello from Seattle.
  • Follow @code
  • Support
  • Privacy
  • Terms of Use
  • License
Microsoft homepage Microsoft homepage © 2020 Microsoft