user13027050
user13027050

Reputation:

Package not created when I create new Java Project from VSCode

When I Create a new Project in Java, I don't get a package and when I manually create it, the Classpath changes.

Upvotes: 0

Views: 1644

Answers (1)

Molly Wang-MSFT
Molly Wang-MSFT

Reputation: 9481

Creating a package in VS Code is equivalent to create a folder, then every time you create a .java file under the package folder, there will be a statement package name; added automatically on the top line. If not, please add it manually to avoid compilation error.

About Classpath, you can get it with the function this.getClass().getResource("/").getPath(), which is already shown in execution scripts:

enter image description here

After creating a package: enter image description here

You can see that the Classpath was the same one and not changed.

Upvotes: 1

Related Questions