DonJayamanne / javaVSCode

Extension for java development on VSCode (deprecated)
https://marketplace.visualstudio.com/items?itemName=donjayamanne.javaDebugger
MIT License
43 stars 29 forks source link

Help setting debugger up & Failed to start the program #62

Closed kayst09 closed 7 years ago

kayst09 commented 7 years ago

Hello. I've been reading some posts regarding setting up and the "failed to start the program" and it seems like everyone has a different issue and whenever I tried their method it doesn't work.

My tasks.json

{
    "version": "2.0.0",
    "type": "shell",
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "shared"
    },
    "isBackground": true,
    "suppressTaskName": true,
    "tasks": [
        {
            "taskName": "build",
            "command": "javac",
            "args": ["-g", "${file}"]
        }
    ]
}

My launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Java",
            "type": "java",
            "request": "launch",
            "stopOnEntry": true,
            "preLaunchTask": "build",        
            "jdkPath": "C:\Program Files\Java\jdk1.8.0_131\bin",
            "cwd": "${fileDirname}",
            "startupClass": "${fileBasenameNoExtension}",
            "classpath": [
                ".",
                "${fileDirname}"
            ],
            "args": []
        }
    ]
}

I keep getting the

Failed to start the program, Error: spawn C:rogram Filesavadk1.8.0_131in\java ENOENT

Also why is the 'b' in bin purple?

3

faustinoaq commented 7 years ago

Just replace "\" by "/"

"C:/Program Files/Java/jdk1.8.0_131/bin"

On Thu, Aug 10, 2017 at 1:47 PM, kpeng9 notifications@github.com wrote:

Hello. I've been reading some posts regarding setting up and the "failed to start the program" and it seems like everyone has a different issue and whenever I tried their method it doesn't work.

My tasks.json { "version": "2.0.0", "type": "shell", "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "isBackground": true, "suppressTaskName": true, "tasks": [ { "taskName": "build", "command": "javac", "args": ["-g", "${file}"] } ] }

My launch.json { "version": "0.2.0", "configurations": [ { "name": "Java", "type": "java", "request": "launch", "stopOnEntry": true, "preLaunchTask": "build", "jdkPath": "C:\Program Files\Java\jdk1.8.0_131\bin", "cwd": "${fileDirname}", "startupClass": "${fileBasenameNoExtension}", "classpath": [ ".", "${fileDirname}" ], "args": [] } ] }

I keep getting the > Failed to start the program, Error: spawn C:rogram Filesavadk1.8.0_131�in\java ENOENT

[image: 3] https://user-images.githubusercontent.com/20728761/29186532-a653b532-7dc1-11e7-80dc-0d4798cecd43.PNG

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DonJayamanne/javaVSCode/issues/62, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7Nxwqiv5xcIcl0-W_BekkgzckAllQBks5sW1A7gaJpZM4Oz1BX .

kayst09 commented 7 years ago

I replaced it and the purple 'b' is gone but it still gives me the same error.

Failed to start the program, Error: spawn C:rogram Filesavadk1.8.0_131\bin\java ENOENT

kayst09 commented 7 years ago

I managed to change all the "\" to "/" and now the error is

Error: Could not find or load main class launch

kayst09 commented 7 years ago

Oh nevermind I didn't run the debug in my java file. Everything works!