Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code projectName

Using VS Code for Java debugging, there must be projectNamedefined in the launch.json file for using the watch-window while debugging.

How to determine and/or define the name of the Java project?

I always get the error message:

Failed to resolve classpath: The project '??' is not a valid java project.

Here my launch.json extract:

        "type": "java",
        "name": "Debug (Launch)-Application<foo>",
        "request": "launch",
        "cwd": "${workspaceFolder}",
        "console": "internalConsole",
        "stopOnEntry": false,
        "mainClass": "FooClass",
        "args": "",
        "projectName": "??",
        "windows": {
            "classPaths": [
                "%CLASSPATH%","C:\\JUnit\\junit-4.12.jar", "C:\\JUnit\\hamcrest-junit-2.0.0.0.jar", "."
            ]
         }
like image 371
bambino307 Avatar asked Jan 28 '18 19:01

bambino307


People also ask

How do I create an .ENV file in Visual Studio Code?

Once you have opened the folder, click on the Explorer icon on the top left corner of the VSCode (or press Ctrl+Shift+E) to open the explorer panel. In the explorer panel, click on the New File button as shown in the following screenshot: Then simply type in the new file name . env ...

Where is the project name in VS Code?

For Maven projects(at least) you can find the project names at the bottom of the vscode sidebar under MAVEN PROJECTS. You can also look for . project files inside your projects. The projectName is there in the name attribute.

Where is launch json in VS Code?

The launch. json file is located in a . vscode folder in your workspace (project root folder).

How do you create launch json in Visual Studio Code?

To create a launch. json file, click the create a launch. json file link in the Run start view. If you go back to the File Explorer view (Ctrl+Shift+E), you'll see that VS Code has created a .


2 Answers

i was going crazy trying to figure out why the update i made to .project and pom.xml didn't change the project name in vs code...

  1. edit projectDescription / name in .project

  2. edit artifactId in pom.xml

  3. here's what i did to get it to reload and show the updated project name:

update project name

https://github.com/Microsoft/vscode-java-debug/blob/main/Troubleshooting.md#failed-to-resolve-classpath

like image 66
Datum Geek Avatar answered Sep 20 '22 17:09

Datum Geek


The VSCode contains JAVA PROJECTS on the sidebar. I am using SSH plugin to connect to a machine where the project actually resides (VS Code runs locally) so the name of the java project is my name and some hash to it

VSCodeSideBar

After adding the hash "_c4503cca" to the projectName in launch.json, the watches in debug mode work fine.

like image 40
BennyHilarious Avatar answered Sep 23 '22 17:09

BennyHilarious