Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8537
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Getting package info from JAR file |
| Date | 2011-10-04 13:49 -0400 |
| Organization | The Wasteland |
| Message-ID | <nospam-5E46EE.13494904102011@news.aioe.org> (permalink) |
| References | <ddacc0ec-0844-4da3-9d22-f6fe6c0440c6@j20g2000vby.googlegroups.com> <j6f4gl$oq1$1@dont-email.me> |
In article <j6f4gl$oq1$1@dont-email.me>, markspace <-@.> wrote: > On 10/4/2011 6:51 AM, laredotornado wrote: > > > > I'm on Win XP using Java 7 but I have access to Unix tools using > > Cygwin. I was wondering, short of unzipping a JAR file and > > searching through it, if there's a way to figure out the package to > > which a class belongs, assuming I know the class name and that the > > JAR file definitely includes a class by this name. > > > Not really, no. If you don't know the package name, the class could > belong to any package. What package does the annotation @ManagedBean > belong too? Well, on my system, there are three ManagedBeans which > belong to different packages, so which one did you want? > > You've got to have the package name or you don't know which class it > is. You can narrow down the list of matching simple names like this: $ jar tf src.jar | grep "/Timer\." src/java/util/Timer.java src/javax/management/timer/Timer.java src/javax/swing/Timer.java And expand the search using find: $ find . -name \*.jar | xargs -I % jar tf % | grep "/Timer\." doc/api/java/util/Timer.html doc/api/java/util/class-use/Timer.html doc/api/javax/management/timer/Timer.html doc/api/javax/management/timer/class-use/Timer.html doc/api/javax/swing/Timer.html doc/api/javax/swing/class-use/Timer.html src/java/util/Timer.java src/javax/management/timer/Timer.java src/javax/swing/Timer.java -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
Getting package info from JAR file laredotornado <laredotornado@zipmail.com> - 2011-10-04 06:51 -0700
Re: Getting package info from JAR file markspace <-@.> - 2011-10-04 07:16 -0700
Re: Getting package info from JAR file "John B. Matthews" <nospam@nospam.invalid> - 2011-10-04 13:49 -0400
csiph-web