在命令行下,如何使用JAD反编译jar文件

在命令行下,如何使用JAD反编译jar文件                                                  

            标签:               jarjavajdk脚本cmd扩展                     

    
      

             分类:        
                           

在工作中,我们经常需要对遗留系统或其他的第三方系统进行维护,如果我们没有Java源文件的情况下,一般都需要将其中的jar文件进行反编译。

 

本文将以如何用命令来反编译一个test.jar文件为例,你可以通过简单修改并将其放入到你的批处理脚本中,进行自动化反编译。

 

1)首先使用jar命令将jar文件解压缩到classes目录(假设你已经设置好了CLASSPATH等,jar.exe是放在jdk的bin目录下的)

CMD>jar -xvf test.jar -C classes

 

2)如果你没有下载过jad的软件,到http://www.kpdus.com/jad.html下载一个,并用解压缩工具将其解压缩到目录[jad_home]

 

3)然后使用jad命令对上面产生的classes目录进行反编译

CMD>[jad_home]/jad.exe -r -ff -d src -s Java classes/**/*.class 

 

其中-r 表示恢复源文件的目录结构,,-ff 表示将类属性定义放在类方法定义之前, -d 表示输出目录,-s 表示文件的扩展名。

所有的java文件将会被放置到src目录下。

JAD Java Decompiler Download Mirror

As http://www.kpdus.com is no longer accessible, JAD Java Decompiler download is extremely hard to find. Here is a mirror where you can get JAD for various platforms.

        

 

        

Installation

Unzip jad.zip file into any appropriate directory on your hard drive. This will create two files:

  • an executable file named 'jad.exe' (Windows 9x/NT/2000) or 'jad' (UNIX)
  • README file 'Readme.txt', which contains the short user's manual

For UNIX users: make 'jad' executable: chmod a+x jad No further setup is required.

Disclaimer

JAD is Copyright 1997-2001 Pavel Kouznetsov.
        All rights reserved.
        THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND        FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR        OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER        IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE        POSSIBILITY OF SUCH DAMAGE.   THE SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE        IN ON-LINE CONTROL OF AIRCRAFT, AIR TRAFFIC, AIRCRAFT NAVIGATION OR AIRCRAFT        COMMUNICATIONS; OR IN THE DESIGN, CONSTRUCTION, OPERATION OR MAINTENANCE OF        ANY NUCLEAR FACILITY. THE AUTHOR DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OFFITNESS        FOR SUCH USES. YOU MUST REPRESENT AND WARRANT THAT YOU WILL NOT        USE THE SOFTWARE FOR SUCH PURPOSES

Thanks to our sponsors who help keeping this software hosted and alive:       Game Hero - Indie Game Developer Community.

 

 

posted @ 2017-07-14 14:04  sky20080101  阅读(1027)  评论(1编辑  收藏  举报