How to make packages in java project in visual Studio Code

We Are Going To Discuss About How to make packages in java project in visual Studio Code. So lets Start this Java Article.

How to make packages in java project in visual Studio Code

  1. How to make packages in java project in visual Studio Code

    Image showing where to Right Click: create a Java Package in VS Code
    Inside the Java Projects tab, right click on the project.
    You can then choose to create a new Java Class or Package.

  2. packages in java project in visual Studio Code

    Image showing where to Right Click: create a Java Package in VS Code
    Inside the Java Projects tab, right click on the project.
    You can then choose to create a new Java Class or Package.

Solution 1

I had the same situation as you, I figured creating packages on my own in VS code, Just follow these steps:
Open up your VS code.

Step 1: Click on “Explorer” , should be at top-left corner.
enter image description here

Step 2: Click on “New Folder”

enter image description here

Step 3: Enter the name of your package here.

enter image description here

Step 4: Drag and drop the your classes in that package.

enter image description here

You are all set now! Good luck!

Original Author Of This Content

Solution 2

Image showing where to Right Click: create a Java Package in VS Code

Inside the Java Projects tab, right click on the project.
You can then choose to create a new Java Class or Package.

Original Author Of This Content

Solution 3

I would recommend checking out Java Env Setup for VS Code.

and secondly:

A package is a path of subdirectories. Say your java sources are in (subdirectory of) a > directory src. All sources immediately under src have the “default” package = no package > declaration.

In src/com/java/learn (4 nested directories) the package com.java.learn; is expected for > java sources.

In your case create a path of 3 directories: com, java, and learn the latter containing > your java source.

recycled from here: How to Start a Java Project with package declaration on Visual Studio Code?

Original Author Of This Content

Solution 4

Just go to explorer and click on new folder. And then name the folder your package name. Drag and drop the classes you want in that package

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment