简体   繁体   English

Visual Studio代码调试器(Java)

[英]Visual Studio Code Debugger (Java)

I keep having troubles with installing the visual studio code installer. 我在安装Visual Studio代码安装程序时一直遇到麻烦。 I have the jdk-installed and I want to debug my code. 我已经安装了jdk,并且想调试我的代码。

I used this tutorial. 我使用了本教程。 https://code.visualstudio.com/blogs/2017/09/28/java-debug https://code.visualstudio.com/blogs/2017/09/28/java-debug

But, the code is not automatically generated inside the json.file. 但是,代码不会在json.file内部自动生成。 When I want to debug the code and generate a debug json.file. 当我想调试代码并生成调试json.file时。 It does not work. 这是行不通的。

Here is the Json file as a code sample: 这是Json文件作为代码示例:

{
// 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 (Attach)",
        "request": "attach",
        "hostName": "localhost",
        "port": 0
    },
    {
        "type": "java",
        "name": "Debug (Launch)",
        "request": "launch",
        "mainClass": "vscode.hallo.java"
    }

]

} }

I can't debug the code. 我无法调试代码。 I receive the error message convertToDto unexpected type. 我收到错误消息convertToDto意外类型。

The possible reason is your bin path is pointing a jre. 可能的原因是您的bin路径指向jre。 But Java Debugger requires you to use JDK instead. 但是Java Debugger要求您改用JDK。 So the fix is changing java.home user setting in VS Code to your JDK home directory. 因此,此修复程序将VS Code中的java.home用户设置更改为JDK主目录。

In my case, uninsall and reinstall the "C/C++ Extension" and than resolve the problem. 就我而言,请卸载并重新安装“ C / C ++ Extension”,然后解决问题。 (My case is occurred in C++ debuging environment) (我的情况发生在C ++调试环境中)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM