Java Package not in Folders

666 views Asked by At

I have a java program where I get the Graphics2D from a BufferedImage via createGraphics() and printed it out and got: sun.java2d.SunGraphics2D[font=java.awt........... you get the idea but when I go to my jdk folder there is no folder in sun called java2d where do I find it?

Edit Ok, I found rt.jar (thank you @EmilyMabrey and @f1sh), and tried to extract it (on Windows 10) with the command jar xf rt.jar but the saw this:

java.io.IOException: META-INF : could not create directory
          at sun.tools.jar.Main.extractFile(Main.java:1050)
          at sun.tools.jar.Main.extract(Main.java:981)
          at sun.tools.jar.Main.run(Main.java:311)
          at sun.tools.jar.Main.main(Main.java:1288)
1

There are 1 answers

0
Emily Mabrey On BEST ANSWER

See this other Stack Overflow Q/A about the runtime JAR (rt.jar or classes.jar depending on the OS you are using). This JAR is basically just like any other JAR you might write for a project, except instead of being a library or application, this JAR contains the classes used within and provided by the JVM itself. Packages define the folder structure of how compiled classes are stored within the JAR (they aren't filesystem folders), so you would have to look into the JAR itself to find the folder/package sun/java2d. You can look at the files and the file structure of the JAR by following the instruction on how to unzip a JAR.