directly read .class file inside .jar file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

directly read .class file inside .jar file

meng
hi,

I want to use vim directly reading a .class file and displays its text content in a buffer.

just to be clear, .jar is java archive file which essentially is a zip file and vim 7.4 can open it out of the box, and by default shows the folder/file structure zipped in it.

.class file is java compiled byte code, it requires a decompiler to turn it back into human readable text content. I have a decompiler called jad which I can invoke %!jad -noctor -ff -i -p "%" to produce the decompiled text.

so I configured vim to recognized .class filetype and set these settings for the filetype:

silent %!jad -noctor -ff -i -p "%"
set readonly
set filetype=java
silent normal gg=G
set nomodified

this works fine if I explicitly extract these .class files and have them stored on disk. when I open the .class files on the fly within vim (recall vim displays the jar content and pressing Enter instructs vim to open the file in a split window and the file path is the content of the current line), then I got this error:

JavaClassFileReadException: can't open input file on `zipfile:/my/wonderful/jar/file/complicated/path/file.jar::path/to/the/class/definition/file/in/the/original/code/structure/classname.class'

basically jad complains the file is not found and the path in question is given between `' marks, which doesn't look like a regular linux path. my question is, where does vim store this file on disk if it is somewhere on disk at all? I assume vim extracts that one file and puts it as a temp file somewhere on disk, and I want to get access to this temp file and let vim to decompile it and just show me the decompiled text instead of the extracted file.

in case this matters, I am on ubuntu 16.04 and using vim 7.4. Thanks.







--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.