Aug 04
javap is one of those nice command line tools that you can use to print out info on a given class.
I sometimes run into problems in a project where the right jars may not all be in my lib directories (see last post ;).
I use a simple ant task to give me a sanity check (outside of my IDE of course, as that may be setup differently).
I run:
% ant find-class -Dclass.name=java.lang.String
and the simple task is…
<!-- =================================================================== -->
<!-- Find the class in the classpath -->
<!-- =================================================================== -->
<target name="find-class" description="Find the class in the classpath">
<fail unless="class.name"
message="You must pass a class name in via -Dclass.name=package.class"/>
<echo message="Finding class: ${class.name}"/>
<exec executable="javap">
<arg line="-classpath ${project.classpath} ${class.name}"/>
</exec>
</target>
I am always surprised that I can’t find a <javap> ant task too.

October 5th, 2006 at 1:09 am
big thank