有人知道可以反编译整个Jar文件而不是单个类的免费反编译器吗?我有一个问题的子类,如名称$1.类名称$2.类名称
当前回答
将以下内容插入到decompile.jar.sh中
# Usage: decompile.jar.sh some.jar [-d]
# clean target folders
function clean_target {
rm -rf $unjar $src $jad_log
}
# clean all debug stuff
function clean_stuff {
rm -rf $unjar $jad_log
}
# the main function
function work {
jar=$1
unjar=`basename $jar.unjar`
src=`basename $jar.src`
jad_log=jad.log
clean_target
unzip -q $jar -d $unjar
jad -d $src -ff -r -lnc -o -s java $unjar/**/*.class > $jad_log 2>&1
if [ ! $debug ]; then
clean_stuff
fi
if [ -d $src ]
then
echo "$jar has been decompiled to $src"
else
echo "Got some problems check output or run in debug mode"
fi
}
function usage {
echo "This script extract and decompile JAR file"
echo "Usage: $0 some.jar [-d]"
echo " where: some.jar is the target to decompile"
echo " use -d for debug mode"
}
# check params
if [ -n "$1" ]
then
if [ "$2" == "-d" ]; then
debug=true
set -x
fi
work $1
else
usage
fi
Chmod +x compile .jar.sh //可执行文件 Ln -s ./ compile .jar。年代/usr/bin/dj
准备使用,只需输入dj你的。jar,你会得到你的。jar.src文件夹的源代码。调试模式使用-d选项。
其他回答
注意:此解决方案仅适用于Mac和*nix用户。
我也试过找杰德,但一无所获。我的快速解决方案是下载包含jad的MacJad。一旦你下载了它,你可以在[where-you-download - MacJAD]/MacJAD/Contents/Resources/jad中找到jad。
首先,值得记住的是,所有Java归档文件(.jar/.war/等等…)基本上都是花哨的.zip文件,并添加了一些清单和元数据。
其次,为了解决这个问题,我个人使用了几个可以在各个层面处理这个问题的工具:
Jad + Jadclipse,在IDE中编译。class文件 WinRAR是我最喜欢的压缩工具,它支持Java存档(请参见第一段)。 Beyond Compare是我最喜欢的差异工具,如果配置正确,它可以在任何归档文件(包括jar)之间进行动态比较。值得一试。
前面提到的优点是,我不需要持有任何其他外部工具,使我的工作环境混乱。我从这些文件中需要的任何东西都可以在我的IDE中处理,或者与其他文件本地进行区别。
如果你碰巧有bash shell和jad:
JAR=(your jar file name)
unzip -d $JAR.tmp $JAR
pushd $JAR.tmp
for f in `find . -name '*.class'`; do
jad -d $(dirname $f) -s java -lnc $f
done
popd
我可能有一点点,一点点的偏差,但它应该或多或少像宣传的那样有效。您应该得到包含反编译文件的$JAR.tmp。
喜欢的东西:
jar -xf foo.jar && find . -iname "*.class" | xargs /opt/local/bin/jad -r
也许?
将以下内容插入到decompile.jar.sh中
# Usage: decompile.jar.sh some.jar [-d]
# clean target folders
function clean_target {
rm -rf $unjar $src $jad_log
}
# clean all debug stuff
function clean_stuff {
rm -rf $unjar $jad_log
}
# the main function
function work {
jar=$1
unjar=`basename $jar.unjar`
src=`basename $jar.src`
jad_log=jad.log
clean_target
unzip -q $jar -d $unjar
jad -d $src -ff -r -lnc -o -s java $unjar/**/*.class > $jad_log 2>&1
if [ ! $debug ]; then
clean_stuff
fi
if [ -d $src ]
then
echo "$jar has been decompiled to $src"
else
echo "Got some problems check output or run in debug mode"
fi
}
function usage {
echo "This script extract and decompile JAR file"
echo "Usage: $0 some.jar [-d]"
echo " where: some.jar is the target to decompile"
echo " use -d for debug mode"
}
# check params
if [ -n "$1" ]
then
if [ "$2" == "-d" ]; then
debug=true
set -x
fi
work $1
else
usage
fi
Chmod +x compile .jar.sh //可执行文件 Ln -s ./ compile .jar。年代/usr/bin/dj
准备使用,只需输入dj你的。jar,你会得到你的。jar.src文件夹的源代码。调试模式使用-d选项。
推荐文章
- 在流中使用Java 8 foreach循环移动到下一项
- 访问限制:'Application'类型不是API(必需库rt.jar的限制)
- 用Java计算两个日期之间的天数
- 如何配置slf4j-simple
- 在Jar文件中运行类
- 带参数的可运行?
- 我如何得到一个字符串的前n个字符而不检查大小或出界?
- 我可以在Java中设置enum起始值吗?
- Java中的回调函数
- c#和Java中的泛型有什么不同?和模板在c++ ?
- 在Java中,流相对于循环的优势是什么?
- Jersey在未找到InjectionManagerFactory时停止工作
- 在Java流是peek真的只是调试?
- Recyclerview不调用onCreateViewHolder
- 将JSON字符串转换为HashMap