• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How to view jar files

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aright, I'm pretty much a java newbie.
I understand the basics of the language but have never done real work in it.
Currently I find myself on a project where I'm going to have to do some java development.
I'm at a stage now where I'd like to know whats in all of the jar files utilized by a 3rd party software company that I am interfacing a portal gadget into.
there are a ton of jar files, I've isolated the one I want to view the contents of, but how do I open the darn thing? I've tried wordpad which obviously doesn't work.
Is there some commands I need to run to seperate the .jar file and then be able to view the contents?
Thanks for any help on this simple/novice problem.
Geoff
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JDK contains a utility called "jar". You can create, update, extract, and view .jar files using the "jar" utility.
Here are some useful commands:

Hope I didn't post too many typos
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can open up, add and remove files from jar files by using winzip if you want, might be of some help to you
 
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I strongly recommend WinRar which is very useful for exploring several kinds of compressed files including ZIP, WAR, TAR etc. I am sure you'ld delighted to get it.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Geoff, if you decide to use WinZip/WinRAR/whatever tools for handling your .jar/.war/.ear files, do remember that a valid .jar file must contain the META-INF/MANIFEST.MF file, which is added by default by the jar utility. With WinZip and others, you must create and add the manifest file yourself (it's not difficult, though).
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The commands lasse gave are right..but u can add option 'v' to get a verbose version ..

// Gives the table of contents in verbose fashion
jar -tvf
similarly,
//Extracts the files by displaying the information of every file that is being extracted.
jar -xvf
 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well thanks for the help! I just used the simple winzip tool and got a peek at all the class files in the jars...
I dont know what I was thinking though, looking at .class files is useless to me! I'm trying to figure out why a .jsp call I'm making is failing and thought that by looking at the code of the method I might get a better handle on things.
Any suggestions?
Is there a way to view a .java file from a .class file?
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Geoff Garcia:

Is there a way to view a .java file from a .class file?


You can actually unjar/unzip the jar file and use a decompiler like JAD to decompile the class file.
http://www.geocities.com/zz_xu/jad.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic