vscode-java-debug icon indicating copy to clipboard operation
vscode-java-debug copied to clipboard

Cannot find main method for Maven project with subprojects

Open mrcjkb opened this issue 4 years ago • 2 comments

Environment
  • Operating System: Arch Linux
  • JDK version: liberica-jdk-11-full
  • Visual Studio Code version: VSCodium 1.56.2
  • Java extension version: 0.77.0
  • Java Debugger extension version: 0.33.1
Steps To Reproduce

Given a Maven project with subprojects, such as this one And VSCode is open with the cwd set to the root of the project And I open a file in one of the subprojects (e.g. XChartDemo.java) And the language server starts successfully And I wait for long enough for the project to be loaded When I try to run the main method

Current Result

Then I get an error message:

Error: Main method not found in the file, please define the main method as: public static void main(String[] args)

Source: Debugger for Java (Extension)
Expected Result

Then the main method is started

Log

lsp.log

mrcjkb avatar May 19 '21 19:05 mrcjkb

Bump?

ryno1234 avatar Jul 03 '22 02:07 ryno1234

I am having same trouble with running a single java file in a maven sub-project. Don't event think that this issue takes too long time to solved or I have to back to super-weight eclipse IDE. Hope it will be solved soon.

Updated: I found that the problem comes from jdk 11, which is the lowest version allowed by VS Code. Since my project requires jdk 8. I think there is no choice for me than bring the eclipse back.

siebonguyen avatar Jul 26 '22 08:07 siebonguyen