• Post Reply Bookmark Topic Watch Topic
  • New Topic

ClassLoading

 
Balaji Saranathan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,,
Thanks for your previous answers...
New one here..
I know that the JVM loads all the classes of lang package and other packages at startup....(verbose option)
But y is that for a program to print just a line like Helloworld , so many classes have to be loaded rather than loading them when needed.
I understand the reason for certain base classes like Object etc, but Y util package ??
Or is it that some classes containing static blocks / methods are loaded???
TIA
Bala
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balaji Saranathan:

I understand the reason for certain base classes like Object etc, but Y util package ??

I just checked up. Yes amazing.
Am not sure probably others can explain.
Now from whatever i saw , it tries to open rt.jar to find the class files which is fine and hence probably needs java.util.zip classes to open/run through the jar first which in turn accesses some util package classes? so they also get subsequently loaded...and so on.
I think java loads classes only when it figures out that it is being used.
 
Mahesh Mamani
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The other classes are loaded only in the "checking <class>" part...
While compiling just the basic classes are loaded.
[parsing started datetest2.java]
[parsing completed 100ms]
[loading D:\jdk1.3.1_02\jre\lib\rt.jar(java/lang/Object.class)]
[loading D:\jdk1.3.1_02\jre\lib\rt.jar(java/lang/String.class)]
[checking datetest2]
[loading D:\jdk1.3.1_02\jre\lib\rt.jar(java/lang/System.class)]
[loading D:\jdk1.3.1_02\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading D:\jdk1.3.1_02\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading D:\jdk1.3.1_02\jre\lib\rt.jar(java/io/OutputStream.class)]
[wrote datetest2.class]
[total 521ms]

Bye,
Mahesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!