This sample code helps to demonstrate simplicity of debugging and developing GraalVM polyglot applications using Visual Studio (VS) Code extensions.
- Install VS Code and launch it.
- Then go to VS Code Extensions activity panel and search for GraalVM Extension Pack, install it. The GraalVM Extension Pack will install all required extensions.
- Open Visual Studio Code, navigate to Extensions activity panel in the left-hand side Activity Bar. Search for “GraalVM” in the search field. Find GraalVM Tools for Java, press Install. Reload if required.
- Install GraalVM in VS Code: Navigate to Gr activity panel in VS Code and install the latest Oracle GraalVM version available from the list.
- Confirm to set this as Active GraalVM for VS Code.
-
Open VS Code Terminal.
-
Clone the repository and navigate into the
polyglot-debug
directory:git clone https://github.com/graalvm/graalvm-demos
cd graalvm-demos/polyglot-debug
-
Build the application using Maven:
mvn clean package
-
Run this application with the following command:
mvn exec:exec
Debugging a polyglot application should work out of the box in VS Code with the GraalVM extension.
-
Place breakpoints in PolyglotDebug.java.
-
To debug the project, go to Run and Debug activity or simply press F5.
-
Choose Launch Java 8+ as this is the Polyglot debugger provided by the GraalVM extension.
That is, the sample is running using the GraalVM debugger.