I want to see all the java packages. Where are the packages stored in my machine? Can anyone help. I did search in jdk folder and found awt.dll and all. But its only a few. Can i see all of them?
The classes belonging to the package java. awt are stored in directory " $BASE_DIR\java\awt\ " while the classes of package java. awt. event are stored in directory " $BASE_DIR\java\awt\event\ ".
A package in Java is used to group related classes. Think of it as a folder in a file directory. We use packages to avoid name conflicts, and to write a better maintainable code. Packages are divided into two categories: Built-in Packages (packages from the Java API)
java in the path /usr/lib/jvm/java-1.5.
the java. lang package is imported by default for any class that you create in Java.
If you want a list of packages in the standard installation, just go to the Javadocs and look in the upper left corner.
If you want to see the .class files, they're in lib\rt.jar
in the JRE directory (.jar
is the same as .zip
, so you can open it with anything that can open zip files).
If you want to see the source code, look in src.zip
in the JDK directory. If it's not there, you probably elected not to install it when you installed the JDK.
Keep in mind that packages are represented as folders on disk, so you might be a little disappointed by what you see.
From Java 9 onwards rt.jar
was removed
The class and resource files previously stored in
lib/rt.jar
,lib/tools.jar
,lib/dt.jar
, and various other internal JAR files are now stored in a more efficient format in implementation-specific files in the lib directory. The format of these files is not specified and is subject to change without notice.
The System class files can now be accessed as shown below
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); Path objClassFilePath = fs.getPath("modules", "java.base", "java/lang/Object.class");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With