Java Reference
In-Depth Information
a class like “com/sun/enterprise/cli/framework/InputsAndOutputs.class”, you cannot continue
your work. You need to find that class. You can tell from the name that it's provided by Sun,
so you might start browsing the Glassfish lib directory and just use the brute-force method of
opening JARs one by one and eyeballing it.
But if you open the lib directory of Glassfish (or WebLogic 10 or WebSphere), there are
dozens of JARs in there! It can be tedious and time-consuming to determine which JAR has
the class you want. You don't know what this class does. You don't even care about this class
at all. You just need your XJC Ant task to work and apparently some class in there needs some
other class that needs this one. But it's not a good practice to throw all of the JARs in there on
your classpath—it's slow and misleading and doesn't help you learn about what's happening
under the hood. And in my view, it's not good to be dependent on the IDE whatsoever. You
should be able to execute Ant from the command line and your build should still work.
As mentioned, each JAR will be named, followed by all of the packages and classes in it. So,
you can then use the less tool to find your guy. Within the less tool, type:
> /InputsAndOutputs
This will search down the contents for the InputsAndOutputs class, and will find and high-
light that text (assuming that the JAR that contains your class actually was in the directory
you ran this command from).
Or you can Ctrl+G to get to the bottom of the file and then search up the file for the first in-
stance of “.jar”. That will be the name of the JAR file containing your class. Run:
> ?.jar
This highlights ./admin-cli.jar, which is indeed the Glassfish JAR file containing Input-
sAndOutputs.class . So now you can drop that on your classpath and get on with your build.
If you don't know what JAR file contains the class you're looking for, this is an easy way to
find it on Linux. Don't forget to delete the “tmp” file if you don't want to leave it around for
another time. The “tmp” files can be very large, depending on the directory in which you run
the command.
Search WWH ::




Custom Search