Languages
Topics Overview JavaScript JSON HTML Emmet CSS, SCSS and Less TypeScript Markdown PowerShell C++ Java PHP Python Julia R Ruby Rust Go T-SQL C# .NET Swift Working with JavaScript Node.js Tutorial Node.js Debugging Deploy Node.js Apps Browser Debugging Angular Tutorial React Tutorial Vue Tutorial Debugging Recipes Performance Profiling Extensions Tutorial Transpiling Editing Refactoring Debugging Quick Start Tutorial Run Python Code Editing Linting Formatting Debugging Environments Testing Python Interactive Django Tutorial FastAPI Tutorial Flask Tutorial Create Containers Deploy Python Apps Python in the Web Settings Reference Getting Started Navigate and Edit Refactoring Formatting and Linting Project Management Build Tools Run and Debug Testing Spring Boot Modernizing Java Apps Application Servers Deploy Java Apps GUI Applications Extensions FAQ Intro Videos GCC on Linux GCC on Windows GCC on Windows Subsystem for Linux Clang on macOS Microsoft C++ on Windows Build with CMake CMake Tools on Linux CMake Quick Start C++ Dev Tools for Copilot Editing and Navigating Debugging Configure Debugging Refactoring Settings Reference Configure IntelliSense Configure IntelliSense for Cross-Compiling FAQ Intro Videos Get Started Navigate and Edit IntelliCode Refactoring Formatting and Linting Project Management Build Tools Package Management Run and Debug Testing FAQOn this page there are 3 sections
Working with GUI applications in VS Code
You can develop Java GUI applications in Visual Studio Code easily. To achieve that, you need to install the Extension Pack for Java, which includes all the required extensions to develop Java GUI applications.
Install the Extension Pack for Java
If you run into any issues when using the features below, you can contact us by entering an issue.
Develop JavaFX applications
Create a new JavaFX project
You can create a new JavaFX application with just a few steps in VS Code:
- Step 1: Install the Extension Pack for Java.
- Step 2: In Visual Studio Code, open the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and then select the command Java: Create Java Project.
- Step 3: Select the option JavaFX in the list, follow the wizard, which will help you scaffold a new JavaFX project via Maven Archetype.
Run the JavaFX application
Note: The following guidance only works for projects managed by Maven. The generated project requires at least JDK 11 to launch it. Please make sure you have JDK 11 installed locally and set the installation path to the setting java.configuration.runtimes.
To run the JavaFX application, you can open the Maven Explorer, expand hellofx > Plugins > javafx and run the Maven goal: javafx:run.
Note: Make sure you have installed the Maven for Java extension. If you cannot find the Maven explorer, open the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and then select the command Explorer: Focus on Maven View.
More JavaFX examples
More JavaFX project examples can be found in the openjfx samples repository, which covers different project structures (such as Gradle and unmanaged folder projects). There is documentation on each sample to describe how to run the program.
Develop AWT applications
By default, the types from the Abstract Window Toolkit (AWT) are hidden. You may notice that code completions are not working when you are developing an AWT application. To enable completions, you can open the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and then select the command Java: Help Center. Go to the Student section and select Enable AWT Development.
Note: This action will update a setting, java.completion.filteredTypes at the workspace level in .vscode\settings.json, so please make sure a workspace is opened in VS Code.
You can use the sample code below to run a simple Java AWT application in VS Code.