What do people do in this situation. Is there some command line or
vim utility I've missed? Thanks!
In both cases, it's quite possible that the class and function/method
names have been either mangled or obfuscated, so Vim will not be able
to make anything of it for you.
I'm not sure what kind of data you are looking to get from the object files.
Fuzzy
Here is an idea. Since Vim already supports browsing zip files, and jar
files are essentially zip files, you can configure Vim to handle them
just like zip files. Here is what I do:
" Have the zip plugin treat a few other types as zip files.
au BufReadCmd *.jar,*.ear,*.war call zip#Browse(expand("<amatch>"))--
When you find the .class file that interests you, you can open the file
and run jad or some other decompiler to see the decompiled source. You
might also try a plugin
(http://www.vim.org/scripts/script.php?script_id=446) on vim.org that
claims to do this automatically, which means simply hitting "o" on the
class that you are interested should get you the Java code.
Once you are viewing the source, you should be able to configure
whichever tags browser that you use to detect that the buffer contains
Java code and show the appropriate tags.
--
HTH,
Hari
>
>
> >
>
>" Have the zip plugin treat a few other types as zip files.
>au BufReadCmd *.jar,*.ear,*.war call zip#Browse(expand("<amatch>"))--
>
>
The updated zip plugin already treats *.jar files as *.zip files. I
think I've already sent a copy on to Bram, too; however, you may also
get a copy from
http://mysite.verizon.net/astronaut/vim/index.html#ZIP
Of course, zip.vim doesn't invoke jad.
Regards,
Chip Campbell
I just know, for example, when I'm using VBA in Word or when I was
using Eclipse with Java, I would frequently just need to see "what
were the classes, method's, and attributes in package/dll/etc X"
A DLL is a binary library which can be invoked at run-time by executable
programs and shared between them. You can try to use the xxd utility
(distributed with Vim, see ":help hex-editing") but you will still have to
know how the binary library is structured to make any sense of it. I don't.
A .jar file (or an .xpi file) is just (IIUC) a zipfile under another name. To
look at their contents, you can temporarily rename foobar.jar (or foobar.xpi)
to foobar.zip. Vim has a standard plugin for zipfiles but I think it relies on
an external program (such as unzip or pkunzip) not distributed with Vim.
Best regards,
Tony.
--
No matter what other nations may say about the United States,
immigration is still the sincerest form of flattery.
The 'nm' commandline utility on Unix does this kind of thing for DLLs and I'm
pretty sure it's included with Cygwin or MinGW or something. Probably part of
binutils or something like that--whatever the linker, ld, is included with, I
reckon. If you have GCC working, you probably have nm anyway.
But it's nasty, as you see mangled names, and so on. Still, it can sometimes help
track down various bits and pieces.
I believe the equivalent tool for Java is javap, and suspect its output will be
nicer than nm, too--less mangling and things.
Ben.
Send instant messages to your online friends http://au.messenger.yahoo.com