-6

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)
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Sean Letendre
  • 2,623
  • 3
  • 14
  • 32
  • We can't answer this question. There's not enough information. – byxor Jan 03 '17 at 08:21
  • 1
    What you're looking for is in the ``rt.jar`` file inside the jdk's/jre's lib folder. Open it with winrar/7zip. This jar file is in the vm's default classpath, which is why you can use in in your application. – f1sh Jan 03 '17 at 08:21
  • 1
    You are getting an error likely because you are running the command using a user without a write permission for the directory `jar xf` is trying to write to. Either run the command using the administrator/root user or run the command from a directory that you do have r/w permissions for. The jar command supports a "-c" option which will simplify using a specific output directory. If you use that option the command becomes `jar xf rt.jar -c `. Make sure to see the JAR Tool help page [here](http://docs.oracle.com/javase/8/docs/technotes/tools/windows/jar.html) – Emily Mabrey Jan 03 '17 at 10:35

1 Answers1

1

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.

Community
  • 1
  • 1
Emily Mabrey
  • 1,528
  • 1
  • 12
  • 29