Dump Classes and Functions from a Jar
I on a regular basis find me in the situation were I need to find out which jar exactly exposes a class or function.
For years I've been using:
Which kind of works, but it does actually not dump all the function names.
So after a bit of research I came up with:
This will produce output like;
See perfect way to find that elusive class/function.
For years I've been using:
# for f in *.jar ; do
echo ===== $f
strings | grep "function"
done
Which kind of works, but it does actually not dump all the function names.
So after a bit of research I came up with:
for f in *.jar ; do
jar tf $f | while read fl ; do
cl=$(echo $fl | sed 's/\//./g');
c=${cl%.*} ;
javap -classpath $f $c;
done;
done
This will produce output like;
....
Compiled from "ServerSessionPool.java"
public interface javax.jms.ServerSessionPool {
public abstract javax.jms.ServerSession getServerSession() throws javax.jms.JMSException;
}
Compiled from "Session.java"
public interface javax.jms.Session extends java.lang.Runnable {
public static final int AUTO_ACKNOWLEDGE;
public static final int CLIENT_ACKNOWLEDGE;
public static final int DUPS_OK_ACKNOWLEDGE;
public static final int SESSION_TRANSACTED;
public abstract javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException;
public abstract javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException;
public abstract javax.jms.Message createMessage() throws javax.jms.JMSException;
public abstract javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException;
public abstract javax.jms.ObjectMessage createObjectMessage(java.io.Serializable) throws javax.jms.JMSException;
....
See perfect way to find that elusive class/function.
Comments