Oracle Java Platform Extension for Visual Studio CodeOracle Java Platform extension brings full featured Java development (edit-compile-debug & test cycle) for Maven and Gradle projects to VSCode. As well as other features. Getting Started
Supported ActionsIn the VS Code command palette :
Project ExplorerProject 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. Debugger and Launch ConfigurationsLanguage Server Java+ ... launch configuration supports debugging and running Java applications using JDK11 or newer.
Launch Configurations
Default launch configurations provided by Language Server can modified in Run Configurations panelProgram arguments, VM options, evironment variables,... can be set in Run Configuration panel a part of Explorer. The panel is sufficient for all typical use-cases Java programmer faces. Only advanced, expert scenarios may require touching of JDK DownloaderIf the system does not detect any JDK, the extension will offer a downloader and setup prompt to help you set up a JDK. This setup provides options for Oracle JDK, OpenJDK, and allows you to choose from any installed JDK on your system.
Alternatively, you can manually specify the path to JDK binaries by utilizing the JDK downloader.
You can also access the JDK downloader through the "Download, install, and Use JDK" option in the command palette. Supported RefactoringsClass level refactorings as well as variable refactorings are supported in VS Code via Oracle Java Platform extension. See following screenshots: Source Action ... context menuIntroduce refactorings available via Show Code actions light bulbMore Refactorings available also using Refactor... context menuSurround with refactoringsSome refactorings are two steps with like Generate Override method ... where method to be overriden is selected in 2nd step: Change Method Parameters refactoringChange method parameters refactoring is provided using dedicated form allowing to change, add, move, remove method parameters. Move Members RefactoringMove members refactoring provides dedicated form as well.
Some of supported refactorings:
Organize ImportsOut of the box support for organizing imports in Java sources is available. It removes unused imports, groups imports by packages and updates your imports whenever a file is saved. In addition to the defaults, there is a rich set of configuration options. Go to VSCode
And JavaDoc smart editingWhen adding JavaDoc to code Oracle Java Platform extension assists by suggesting to insert preformatted and prepopulated JavaDoc comment. Type Test ExplorerOracle Java Platform extension provides Test Explorer view which allows to run all tests in a project, examine the results, go to source code and run particular test. Supported Options
Selecting the JDKThe user projects are built, run and debugged using the same JDK which runs the Oracle Java Platform extension. The JDK is being searched in following locations:
As soon as one of the settings is changed, the Language Server is restarted. Running Language Server per VSCode workspace or for userIt is possible to run Oracle Java Platform extension per workspace (VSCode window). This allows separation of Language Server for given project as Language Server JVM is not shared for more VSCode open workspaces (projects).
It is possible to change this in ContributingThis project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide SecurityPlease consult the security guide for our responsible security vulnerability disclosure process LicenseCopyright (c) 2023 Oracle and/or its affiliates. Oracle Java Platform Extension for Visual Studio Code is licensed under Apache 2.0 License. The THIRD_PARTY_LICENSES file contains third party notices and licenses. |