Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Sascha edited this pageNov 7, 2022 ·3 revisions

Adapter definition

The debug adapter for Java is an extension toeclipse.jdt.ls:java-debug.

That means in order to use the debug adapter you need a language-server-protocol client.There is no standalone Java debug adapter

Via nvim-jdtls

Installnvim-jdtls and follow the instructions in the README to setup nvim-dap.

Youdo not have to definedap.adapters.java yourself.

Via other language server clients

You'll need a LSP client that supports executing custom commands. You'll have to installjava-debug and configure eclipse.jdt.ls to load it, seeUsage with eclipse.jdt.ls

Then you can define something like this:

localdap=require('dap')dap.adapters.java=function(callback)-- FIXME:-- Here a function needs to trigger the `vscode.java.startDebugSession` LSP command-- The response to the command must be the `port` used belowcallback({type='server';host='127.0.0.1';port=port;  })end

Configuration

You may also want to add a configuration to debug remote applications:

localdap=require('dap')dap.configurations.java= {  {type='java';request='attach';name="Debug (Attach) - Remote";hostName="127.0.0.1";port=5005;  },}

A configuration to launch a main class could look like this:

localdap=require('dap')dap.configurations.java= {  {-- You need to extend the classPath to list your dependencies.-- `nvim-jdtls` would automatically add the `classPaths` property if it is missingclassPaths= {},-- If using multi-module projects, remove otherwise.projectName="yourProjectName",javaExec="/path/to/your/bin/java",mainClass="your.package.name.MainClassName",-- If using the JDK9+ module system, this needs to be extended-- `nvim-jdtls` would automatically populate this propertymodulePaths= {},name="Launch YourClassName",request="launch",type="java"  },}

To get an overview of all availableattach andlaunch options, take a look atjava-debug options. Keep in mind that anyjava.debug options are settings of the vscode-java client extension and not understood by the debug-adapter itself.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp