| |
Using the DOS for command to find a class
Using the DOS for command to find a class
Sometimes I
find myself in the situation of using a Java class in a piece of code,
but not knowing which JAR file the specfic class file resides in. This
happened quite recently when I was coding up some extensions to use
connect to an internal development build of OC4J using the JMX remote
API -- JSR160. I couldn't easily identify which JAR file in the
OC4J distribution contained the Oracle specific class I was using.
So for my own future reference, here's how to do it using a combination
of the DOS for command, the jar command from the JDK, and the grep
utility from MKS or Cygwin,
D:javaoc4j-main-latestj2eehomelib>for %f in (*.jar) do jar tf %f | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf servlet.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf ojsp.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf jndi.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf crimson.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf jmx_remote_api.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf activation.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf bcel.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf commons-el.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf jta.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf ojdl.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf jmxri.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf cos.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf jaxp.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf connector.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf jax-qname-namespace.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf javax88.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf jaxrpc-api.jar | grep Domain
D:javaoc4j-main-latestj2eehomelib>jar tf javax77.jar | grep Domain
...
...
D:javaoc4j-main-latestj2eehomelib>jar tf adminclient.jar | grep Domain
oracle/oc4j/admin/jmx/shared/Domain.class <-------------------------- there's my boy!
oracle/oc4j/admin/jmx/shared/DomainBase.class
oracle/oc4j/admin/jmx/shared/IasDomain.class
oracle/oc4j/admin/jmx/shared/IasRmiDomain.class
oracle/oc4j/admin/jmx/shared/RmiDomain.class
oracle/oc4j/admin/jmx/shared/Oc4jApplicationLevelDomain.class
oracle/oc4j/admin/jmx/shared/Oc4jDomain.class
oracle/oc4j/admin/jmx/shared/Oc4jRmiApplicationLevelDomain.class
oracle/oc4j/admin/jmx/shared/Oc4jRmiDomain.class
oracle/oc4j/admin/jmx/client/IasDomainFactory.class
oracle/oc4j/admin/jmx/client/Oc4jDomainFactory.class
oracle/oc4j/admin/deploy/gui/DomainNode.class
...
...
Simple. It may not be perfect and still requires a little bit of
trolling of the output, but at least it distills it down to a more
manageable level.
© Copyright 2004 buttso.
Last update: 3/30/2004; 3:08:37 PM.
|
|