Skip to content
Advertisement

Extract class names from JAR with special formatting

How would I extract all the available classes from a Jar file and dump the output, after some simple processing, to a txt file.

For example, if I run jar tf commons-math3-3.1.6.jar a subset of the output would be:

JavaScript

I would like to convert all / to .

And all $ to .

Finally I would also like to remove the .class that appears at the end of every string.

For instance:

JavaScript

would become

JavaScript

Advertisement

Answer

JavaScript
Advertisement