Description
[VS Code has prompted "No delegateCommandHandler" while debugging the Java program]
Environment
- Operating System:
macOS Monterey Version 12.6.5
- JDK version:
1.8.0_292 (x86_64) "AdoptOpenJDK"
- Visual Studio Code version:
1.78.1
- Java extension version:
(Language Support for Java(TM) by Red Hat) v0.64.1
- Java Debugger extension version:
(Debugger for Java) v0.50.0
Steps To Reproduce
- Create a java file and the launch JSON file for VS Code, then compile and run.
Compile and run are successful, also, output the result of this java program. just liking:

- Run&Debug using "StartDebugger(F5)" Button
VS Code has prompted "No delegateCommandHandler for vscode.java.resolveMainMethod
".
A Sample Project
My workspace, just liking:
testJavaDevelopDemo
|____ .vscode
| |___ launch.json
|____ testDemo.java
My "testJavaDevelopDemo/.vscode/launch.json
" just liking:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Launch)",
"request": "launch",
"mainClass": "${file}",
"console": "integratedTerminal"
}
]
}
My "testJavaDevelopDemo/testDemo.java
' just liking:
public class testDemo {
public static void main(String[] args) {
int a=1;
int b=2;
int c = a + b;
System.out.println(a+"+"+b+"="+c);
System.out.println("hello world");
}
}
LOGS
Sorry, I had not known how to check out the logs of debugging.
Current Result
The VSCode
has prompted "No delegateCommandHandler for vscode.java.resolveMainMethod
"
while I click the "Start Debugger(F5)
" button. Just like the below picture showing:

Notice Prompt: No delegateCommandHandler for vscode.java.resolveMainMethod
Expected Result
The VSCode
could enter Debugger
status while I click the StartDebugger(F5)
button, just liking the below picture.

Notice: Successfully Start Debugger
Additional Informations
Try to fix the problem
- Restart&Reboot Again Ang Again
I refer the Troubleshooting of vscode-java-debug, restart the "VSCode
" once and the issue appear again, then reboot the
laptop and "VSCode
", but that still a problem.
- Downgrading Version And Reload Required
Also, I found the same error liking #1308, tried to Downgrading versions of
the Test Runner for Java extension, also, I pressed "reload required" button next to the "uninstall
" button,
but that did not fix my issue.
SO I have to open this issue!
Java Home configuration
Just add the below code into my ZSH
configuration file ~/.zshrc
.
JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
Also, I config the "javahome
" on the Settings
of VSCode
.
Others Environment
- Java extension version:
(Extension Pack for Java) v0.9.1
- Java Test Runner extension version:
v0.38.2
- Maven for Java version:
v0.41.0
- Project Manager for Java version:
v0.22.0
- IntelliCode extension version:
v1.1.8
- IntelliCode API Usage Examples extension verison:
v0.2.7