...
- Support for JDK 8. (The Red Hat extension requires JDK 11 or above.)
- Polyglot debugging.
- Support for OpenJDK projects.
Getting Started
Get VSApacheNetBeans the latest Apache NetBeans VSCode extension from the official VS Code market place, once it is available there.
or download the latest development version of Until then, download the Apache NetBeans Language Server extension and install it into VSCode via Install from VSIX...
...
1. Get an existing Java project, for example, Micronaut: https://micronaut.io/launch/
Don't forget to select Maven and JavaJava. You can select both Maven or Gradle. Generate the project, download it, extract it into local disk.
...
- Clone sample repository and move to the newly cloned directory.
- Make sure that
JAVA_HOME
points at a JDK11 (or later)export JAVA_HOME=/path/to/jdk11.
- Although this archetype is named *jdk11* it can be used with JDK 8 as well, just set to both variables
JAVA_HOME
andnetbeans.jdkhome
to your JDK8 home.
- Although this archetype is named *jdk11* it can be used with JDK 8 as well, just set to both variables
- In VS Code, go to Preferences | Settings, search for
netbeans.jdkhome
, and set it to/path/to/jdk11
(or later). - Open Folder with
graal-js-jdk11-maven-demo
in VSCode. - Remove
App.java
andAppTest.java
originally coming with the sample Maven project.
...
Happy Polyglot development and debugging with VSNetBeans!
Scenario 3: Open OpenJDK Source
to be done...
...
The OpenJDK sources can be directly open in VS Code using VSNetBeans.
SetUp
Follow these steps to prepare the OpenJDK sources:
- Clone the OpenJDK from https://github.com/
...
- openjdk/jdk
- configure using
bash configure,
and provide a path to jtreg, like using the--with-jtreg=<JTREG_HOME>
option - build the JDK using
make images
Open Sources
To open an OpenJDK module inside VS Code, open the src/<module-name>
directory. For example, to open the most basic java.base
module, open src/java.base
. When opening the first module, use File/Open Folder...
, to open additional modules and/or tests, using File/Add Folder To Workspace...
. Tests are typically in either the test/jdk
or test/langtools
folder.
After opening the folders, it is recommended to wait for the "Indexing Complete." messages in the status line.
Then, enjoy browsing and editing the OpenJDK sources!
Scenario 4: GraalVM Sources
Get the Graal repository (or related repositories like Graal.js, Graal Python, etc.) and prepare it for development (most importantly make sure the mx tool is on PATH
). Then select a suite (graal/sdk
, graal/truffle
, graal/compiler, etc.
) and build it using mx build
. Then open the suite in code
as a folder (_File/Open Folder_). Wait for the Apache NetBeans Language Server extension to be initialized (shows Indexing finished in the status line). Use Ctrl-O to open any Java file. Edit, use code completions provided by the system, open tests, run and debug them. Open a test class, locate @Test
method to debug and choose Debug :
The system invokes mx build
and mx unittest ...
automatically for you and connects debugger to the started JVM. Then it's up to you to step through the code, hit breakpoints, etc. Should you debug Truffle language (like JavaScript, Python, etc.), the debugger steps in and shows you the guest language statements - see scenario 2 for more details.
Should you need to explicitly build from the code
choose Ctrl+Shift-P and type Java: Compile Workspace - that invokes mx build
.