A JAR (Java Archive) is a package file format typically used to many Java class files and associated metadata and resources (text, images, etc.) into one file to distribute application software or libraries on the Java platform.
Some native Java IDEs have this feature inbuilt such as Netbeans, Eclipse, etc. Anyway, VS Code is a more flexible IDE in today's competition, we can build Java applications using extensions in VS Code.
Typical Java programmers write many util programs to use in many projects running in Java so they can’t always migrate the bunch of Java files with packages into other projects which is the kind of painful process and also sometimes it may make many conflicts with existing packages.
So a better solution is to use JAR files to carry those sets of files as packages and import anywhere it is required. This is a better extension you can find now on the internet to build Jar files from Java files on VS Code.