Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the Java System Packages stored?

Tags:

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?

like image 488
asb Avatar asked Aug 06 '09 17:08

asb


People also ask

Where are the Java packages located?

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\ ".

What are system packages in Java?

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)

Where are Java packages located in Linux?

java in the path /usr/lib/jvm/java-1.5.

In which package all the Java packages reside?

the java. lang package is imported by default for any class that you create in Java.


2 Answers

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.

like image 169
Michael Myers Avatar answered Sep 19 '22 20:09

Michael Myers


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"); 
like image 21
Venkata Raju Avatar answered Sep 18 '22 20:09

Venkata Raju