Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No delegateCommandHandler for vscode.java.resolveMainMethod #1342

Closed
SofijaErkin opened this issue May 11, 2023 · 2 comments
Closed

No delegateCommandHandler for vscode.java.resolveMainMethod #1342

SofijaErkin opened this issue May 11, 2023 · 2 comments

Comments

@SofijaErkin
Copy link

[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
  1. 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:

Screen Shot 2023-05-11 at 22 03 58
  1. 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:

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

Screen Shot 2023-05-11 at 21 55 55
                                Notice: Successfully Start Debugger 
Additional Informations
Try to fix the problem
  1. 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.

  1. 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
@testforstephen
Copy link
Contributor

Java extension version: (Language Support for Java(TM) by Red Hat) v0.64.1

The latest version of Java Debugger extension is incompatible with RedHat Java extension 0.64.1. To avoid any issues, please update your RedHat Java extension to the most recent version.

@SofijaErkin
Copy link
Author

I've just reverted the version of "'Debugger for Java'" from v0.50.0 into v0.20.0, and my Project "testDemo" worked! Also, updating the version of "Language Support for Java(TM) by Red Hat" to the latest "v1.18.0" fixed my trouble.
Finally, @testforstephen, thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants