Skip to content

Latest commit

 

History

History

polyglot-debug

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Debugging a Java with JavaScript Embedding Application

This sample code helps to demonstrate simplicity of debugging and developing GraalVM polyglot applications using Visual Studio (VS) Code extensions.

Prerequisites

  1. Install VS Code and launch it.
  2. 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.
  3. 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.
  4. Install GraalVM in VS Code: Navigate to Gr activity panel in VS Code and install the latest Oracle GraalVM version available from the list.
  5. Confirm to set this as Active GraalVM for VS Code.

Build and Run the Application

  1. Open VS Code Terminal.

  2. Clone the repository and navigate into the polyglot-debug directory:

    git clone https://github.com/graalvm/graalvm-demos
    cd graalvm-demos/polyglot-debug
  3. Build the application using Maven:

    mvn clean package
  4. Run this application with the following command:

    mvn exec:exec

Debug the Application

Debugging a polyglot application should work out of the box in VS Code with the GraalVM extension.

  1. Place breakpoints in PolyglotDebug.java.

  2. To debug the project, go to Run and Debug activity or simply press F5.

  3. 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.