Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

List of Functions in a Jar File

avatar
Expert Contributor

How to get the list of functions available in any jar file?

Let us say I have Piggybank.Jar.It contains Reverse,UnixToISO() etc.

Is there any command to get list of functions available in Jar file rather than using Google for it?

1 ACCEPTED SOLUTION

avatar
Super Guru

@vamsi valiveti,

You need atleast the classname to get all the methods available in the class. I can think of a solution without Google.

Method 1: Run this command (Replace jar-path with real jar path)

jar -tf {jar-path} | grep -i class | sed -e 's/\//./g' | sed -e 's/\.class//g' | xargs javap -classpath {jar-path}

Method 2:

You can open the Jar file and check the list of the classes and then list the methods in the class

1) Check the classnames using vim (not vi)

vim  Piggybank.jar

2) Take the clasname in which you want to list the methods (copy the path including package name)

javap -classpath {path-to-jar-file} {full-class-name-including-package-name}
ex: javap -classpath example.jar org.apache.hadoop.xyz.Abc (Abc is the class name)

.

If this helps, please take a moment to login and Accept the answer.

View solution in original post

1 REPLY 1

avatar
Super Guru

@vamsi valiveti,

You need atleast the classname to get all the methods available in the class. I can think of a solution without Google.

Method 1: Run this command (Replace jar-path with real jar path)

jar -tf {jar-path} | grep -i class | sed -e 's/\//./g' | sed -e 's/\.class//g' | xargs javap -classpath {jar-path}

Method 2:

You can open the Jar file and check the list of the classes and then list the methods in the class

1) Check the classnames using vim (not vi)

vim  Piggybank.jar

2) Take the clasname in which you want to list the methods (copy the path including package name)

javap -classpath {path-to-jar-file} {full-class-name-including-package-name}
ex: javap -classpath example.jar org.apache.hadoop.xyz.Abc (Abc is the class name)

.

If this helps, please take a moment to login and Accept the answer.