Vscode-java-debug: Failure to recognize new directory/path and run new java file within Java: Create Java Project

Created on 4 Oct 2019  路  1Comment  路  Source: microsoft/vscode-java-debug

Environment
  • Operating System: Windows 10
  • JDK version: 11.0.4
  • Visual Studio Code version: 1.38
  • Java extension version: 0.8.0
  • Java Debugger extension version: 0.22.0
Steps To Reproduce
  1. ctrl + shift + p to editor commands
  2. Select and run through Java: Create Java Project
  3. Add a new folder to src folder or app folder and then add a new java file to that new folder > try to run/debug said file
  4. When this error pops up:
    Error Message on bottom right of editor:
    Build failed, do you want to continue?
    Source: Debugger for Java (Extension)

Click Proceed.

  1. Error: Could not find or load main class test.Test
    Caused by: java.lang.ClassNotFoundException: test.Test
Current Result

Error Message on bottom right of editor:
Build failed, do you want to continue?
Source: Debugger for Java (Extension)

Proceed
Error: Could not find or load main class test.Test
Caused by: java.lang.ClassNotFoundException: test.Test

Expected Result

Recognize new folder within project and run file as normal.

Additional Informations

I'm sure I'm missing something but I did get it to recognize the new folder I created and run the java file within it AFTER I made seemingly any small change in the .classpath file and saving (reverting afterward of course).

Once I saved that change it seems it would then recognize that folder/file path and successfully run/debug the file in it.

Is there any other way to have new folder paths recognized?

Most helpful comment

In file explorer, right click the folder, select "Add Folder to Java Source Path" menu, and it will mark the folder as a source root.

>All comments

In file explorer, right click the folder, select "Add Folder to Java Source Path" menu, and it will mark the folder as a source root.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

testforstephen picture testforstephen  路  4Comments

TheSinding picture TheSinding  路  6Comments

PG-practice picture PG-practice  路  3Comments

manastalukdar picture manastalukdar  路  7Comments

isidorn picture isidorn  路  4Comments