SkillAgentSearch skills...

Javavscode

Java platform support for Visual Studio Code for full featured Java development (edit-compile-debug & test cycle)

Install / Use

/learn @oracle/Javavscode
About this skill

Quality Score

0/100

Supported Platforms

GitHub Copilot

README

<!-- Copyright (c) 2023-2026, Oracle and/or its affiliates. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- This file has been modified for Oracle Java Platform extension -->

Java Platform Extension for Visual Studio Code

Visual Studio Marketplace Installs Build Status License

Java Platform extension from Oracle brings full-featured development support (edit-compile-debug & test cycle) to VS Code. It also offers support for Maven and Gradle projects. Applications using JDK 8 and above are supported.

Getting Started

  1. See the VS Code Tips wiki for a quick primer on getting started with VS Code.
  2. Setting up the JDK
    • If no JDK is present in your system then the extension can set things up for you. For more details refer to JDK Downloader section.
    • Set the VS Code Settings | Jdk: Jdkhome setting to point to the JDK that the Language Server will run on and also by default use for running and compiling projects.
      • The extension requires JDK 17 or newer to run.
    • Optionally, set a different JDK to compile and run projects in the Settings | Jdk › Project: Jdkhome setting.
      • By default, the jdk.jdkhome setting is used.
      • Projects can run on JDK 8 and above.
    • For more information, see the section Selecting the JDK.
  3. Use any one of the following ways to start coding, compiling and debugging in Java.
    • Simply create a new Java class with main method.
    • Use the Java: New File from Template... command to create a new Java file.
    • Use the Java: New Project... command to create a new project.
    • Open the folder with existing Maven or Gradle project files (pom.xml or build.gradle, gradle.properties).

Supported Actions

In the VS Code command palette:

  • Java: New Project... allows creation of new Maven or Gradle project
  • Java: New File from Template... adds various files to the currently selected open project. Files are:
    • Java - broad selection of various predefined Java classes
    • Unit tests - JUnit and TestNG templates for test suites and test cases
    • Other - various templates for Javascript, JSON, YAML, properties, ... files
  • Java: Create New Notebook... command to create a new Java notebook (.ijnb file)
  • Java: Open JShell... command to open JShell.
  • Java: Compile Workspace - invoke Maven or Gradle build
  • Java: Clean Workspace - clean Maven or Gradle build
  • Download, install and Use JDK - allows download and installation of JDK binaries
  • Debugger Java+... - start main class or test on selected JDK. More in Debugger section
  • Test Explorer for Java tests results visualization and execution including editor code Lenses.
  • Maven and Gradle support including multi-project projects, subprojects opening and Gradle priming builds.
  • Java: Go To Test/Tested Class - Navigates to the corresponding test or source class file

Project Explorer

Project Explorer provides an overview of logical project structure, groups sources together and greatly simplifies Java package structure exploration. Project Explorer is an addition to the classical workspace explorer. Use it to build, test, execute and operate your Maven and Gradle Java projects.<br/> Project Explorer

Interactive Java Notebooks

Introduction

  • Experience interactive coding with Java notebooks. See the Using Interactive Java Notebooks wiki for guidance and tutorials on using notebooks.
  • Use the Java: Create New Notebook... command to create a new Java notebook (.ijnb file)<br/> Java Notebook
  • Add code snippets with + Code button and document with markdown cells using the + Markdown button.
  • Double-click on a cell to edit and press Esc when done.
  • Jupyter-style notebooks let you combine Java code snippets with markdown-formatted text cells.
  • Run individual code cells or execute the entire notebook.
  • Save outputs alongside code cells.
  • Sharing notebooks:
    • Share as .ijnb files for use with the Oracle Java extension.
    • Rename with a .ipynb extension for viewing in other IDEs, such as Jupyter.
  • Download the sample notebooks and open them in VS Code to get started.

Java Notebooks for Java Projects

  • Document Java projects with interactive Java notebooks.
    • Open or create a Java notebook in your workspace folder loaded with classes from your project.<br/> Java Notebook For Project
    • Use the Project Context options to switch to a different project context.<br/> Switch Project Context
  • Provide code snippets, markdown explanations, and expected outputs.

Notebook Configurations

The following configuration settings are available:

  • jdk.notebook.classpath
  • jdk.notebook.modulepath
  • jdk.notebook.addmodules
  • jdk.notebook.enablepreview
  • jdk.notebook.implicitimports
  • jdk.notebook.vmOptions

These settings override settings inferred from project context.

Note: If you change these settings while a notebook is open, click Restart kernel to apply the changes.

JShell

  • Use the Java: Open JShell... command to open JShell.
  • Project classes from currently open project are automatically loaded.<br/> JShell

Debugger and Launch Configurations

Language Server Java+ ... launch configuration supports debugging and running Java applications using JDK11 or newer.

  1. The launch configuration (debugger) is invoked when Run main | Debug main codelens is selected in the code.
  2. Or Java+... is selected in Run and Debug activity panel.</br> Debug configurations

Launch Configurations

  • Launch Java App - Debug or Run current Java project
  • Attach to Port & Attach to Process - Attach debugger actions. Available when Java+ ... at the bottom of drop down list is selected.
    • Select this configuration, then click the Run button.
    • Select either from available process or enter the port to connect to JVM running with JDWP.
    • Attach to Shared Memory is available on Windows in addition to above mentioned Attach...

Default launch configurations provided by Language Server can modified in launch.json file.

Run Configurations panel

Program arguments, VM options, environment variables, etc., can be set in the Run Configuration panel as part of Explorer. The panel is sufficient for all typical use-cases Java programmer faces. Only advanced, expert scenarios may require touching of launch.json (which still takes precedence).<br/> Run Configuration

Maven User Settings

For Maven projects, extension can use a custom Maven user settings.xml file.

Set jdk.maven.userSettings to the path of the Maven user settings.xml file that should be used instead of the default ${user.home}/.m2/settings.xml. Currently, this setting supports absolute paths only.

JDK Downloader

If the system does not detect any JDK, the extension will offer a downloader and setup prompts to help you set up a JDK. This allows you to get the latest Oracle JDK build for your system. Additionally, it provides options for different Oracle JDK and Oracle OpenJDK builds with system OS and architecture variants.

Alternatively, you can manually select an already installed JDK to use with the extension through the "Select an installed JDK" command in the VS Code command palette.

You can also access the JDK downloader through the "Download, install, and Use JDK" option in the command palette.<br/> JDK Downloader

Enabling Java Preview Features

When using preview features use the quick fix action option to easily enable them.

Enable Preview

Supported Refactorings

Class level refactorings as well as variable refactorings are supported in VS Code via the Oracle Java Platform extension. See the following screenshots:

Sourc

View on GitHub
GitHub Stars309
CategoryDevelopment
Updated16h ago
Forks70

Languages

TypeScript

Security Score

100/100

Audited on Apr 7, 2026

No findings