Along the same lines, but without having to use perl, you can just use the “jar” command, which has the same general syntax as “tar”.
e.g. tar -tf classes.jar META-INF/ META-INF/MANIFEST.MF META-INF/mailcap.default META-INF/mimetypes.default META-INF/services/com.sun.jdi.connect.Connector META-INF/services/com.sun.jdi.connect.spi.TransportService …blah, blah, blah… java/lang/CharSequence.class java/lang/Comparable.class java/io/Serializable.class java/lang/String.class java/lang/Object.class and pipe it through a filter to limit the output to a dull roar: tpa10% tar -tf classes.jar | grep "[/.]String.class" com/sun/org/apache/xpath/internal/operations/String.class java/lang/String.class Whichever way works for you. Tom Anderson Ex ignorantia ad sapientiam e tenebris ad lucem! > On Feb 18, 2016, at 7:11 AM, Nix, Robert P. <[email protected]> wrote: > > Here¹s a quick example of how to begin to implement my suggestion > previously sent: > > #! /usr/bin/perl > > use strict; > use warnings; > > use Archive::Zip; > > # List the members of > ../Downloads/apache-drill-1.4.0/jars/3rdparty/avro-ipc-1.7.7-tests.jar > > my $zip = Archive::Zip->new( > '../Downloads/apache-drill-1.4.0/jars/3rdparty/avro-ipc-1.7.7-tests.jar' ); > > my @members = $zip->memberNames(); > > for my $i ( @members ) { > if ( $i =~ m/(.+)\.class/ ) { > my $class = $1; > $class =~ s/\//\./g; > print "$class\n"; > } > } > > This produces a list similar to: > > org.apache.avro.TestSchema > org.apache.avro.TestProtocolReflect > org.apache.avro.FooBarSpecificRecord$Builder > org.apache.avro.generic.TestDeepCopy > org.apache.avro.FooBarSpecificRecord > org.apache.avro.TestProtocolSpecific$HandshakeMonitor > > > > > -- > Robert P. Nix | Sr IT Systems Engineer | Data Center Infrastructure > Services > > Mayo Clinic | 200 First Street SW | Rochester, MN 55905 > 507-284-0844 | [email protected] > "quando omni flunks moritati" > > > > > On 2/18/16, 3:52 AM, "Linux on 390 Port on behalf of Jake Anderson" > <[email protected] on behalf of [email protected]> wrote: > >> Hello, >> >> Cross posted to Linux_390 and OMVS-OE. >> >> Is there a way to specifically search a Java class in a jar file ? The >> situation is high many jar file but I want to point out the exact jar file >> where the java class is present. >> >> Regards, >> Jake >> >> ---------------------------------------------------------------------- >> For LINUX-390 subscribe / signoff / archive access instructions, >> send email to [email protected] with the message: INFO LINUX-390 or >> visit >> http://www.marist.edu/htbin/wlvindex?LINUX-390 >> ---------------------------------------------------------------------- >> For more information on Linux on System z, visit >> http://wiki.linuxvm.org/ > > ---------------------------------------------------------------------- > For LINUX-390 subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO LINUX-390 or visit > http://www.marist.edu/htbin/wlvindex?LINUX-390 > ---------------------------------------------------------------------- > For more information on Linux on System z, visit > http://wiki.linuxvm.org/ > ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/
