Home > other >  Cannot run program in java inside a package in vscode
Cannot run program in java inside a package in vscode

Time:06-24

why my vscode is not runing programs in package. i am able to run them once I import package and run the program outside any package. But when I am trying to run them inside a package it is giving an error-:

Error: Could not find or load main class arraystring Caused by: java.lang.NoClassDefFoundError:

for example: enter image description here

enter image description here

This is consistent with what you showed, but the results are different. I think the directory structure is inconsistent, or there is an error in the location of the terminal when you run the file.

  • Related