Reputation: 11538
When we compile a java program, we get .class files. Can I access these .class files of java core libraries? e.g. can I have access to java.lang.String.class ?
Actually I am doing a research and trying to find branch coverage of some java core libraries. The tool I am using for branch coverage actually instruments the .class files.
Thanks
Upvotes: 3
Views: 460
Reputation: 28875
It's in rt.jar
in your JRE directory. You've even got the sources in src.zip
. (Or you could just pull the latest version of OpenJDK.)
Also, if you want to instrument the base classes, you'll also need to specify a boot classpath. Look at the -Xbootclasspath
option for java
: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html
Upvotes: 5
Reputation: 7826
Yes, the class files are inside the #{JDK INSTALL PATH}/jre/lib/rt.jar archive. Or if you use an IDE like Eclipse you can ctrl+click on any string method, or on "String" in declarations like private String var;
to open that class.
Upvotes: 1