Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

List of Functions in a Jar File

Solved Go to solution
Highlighted

List of Functions in a Jar File

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

Accepted Solutions

Re: List of Functions in a Jar File

@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.

1 REPLY 1

Re: List of Functions in a Jar File

@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.

Don't have an account?
Coming from Hortonworks? Activate your account here