Quiltflower is a modern, general purpose decompiler focused on improving code quality, speed, and usability.
Quiltflower is a fork of Fernflower and Forgeflower.
Changes include:
New language features (Try with resources, switch expressions, pattern matching, and more)
Better control flow generation (loops, try-catch, and switch, etc.)
More configurability
Better error messages
Javadoc application
Multithreading
Optimization
Many other miscellaneous features and fixes
Originally intended just for use with the QuiltMC toolchain with Minecraft, Quiltflower quickly expanded to be a general purpose java decompiler aiming to create code that is as accurate and clean as possible.
If the name sounds familiar it's because Quiltflower is a fork of Fernflower, the (in)famous decompiler that was developed by Stiver, maintained by Jetbrains, and became the default decompiler in Intellij IDEA.
Fernflower also quickly found its way into many other tools.
Over the past year, Quiltflower has added support for features such as modern string concatenation, a code formatter, sealed classes, pattern matching, switch expressions, try-with-resources, and more. Quiltflower also focuses on the code quality of the decompiled output, and takes readability very seriously.
The JD-Eclipse doesn't seem to have changed since late 2009 though (see Changes).
So its integration with latest Eclipse (3.8, 4.2+) might be problematic.
JD-Core is actively maintained.
Both are the result of the fantastic work of (SO user) Emmanuel Dupuy.
上述所有优点的优点是,我不需要持有任何其他外部工具来扰乱我的工作环境。 我从这些文件之一中需要的所有内容都可以在我的 IDE 中处理,或者与其他文件本地进行比较。
First of all, it's worth remembering that all Java archive files (.jar/.war/etc...) are all basically just fancy.zip files, with a few added manifests and metadata.
Second, to tackle this problem I personally use several tools which handle this problem on all levels:
Jad + Jadclipse while working in IDE for decompiling .class files
WinRAR, my favorite compression tool natively supports Java archives (again, see first paragraph).
Beyond Compare, my favorite diff tool, when configured correctly can do on-the-fly comparisons between any archive file, including jars. Well worth a try.
The advantage of all the aforementioned, is that I do not need to hold any other external tool which clutters my work environment. Everything I will ever need from one of those files can be handled inside my IDE or diffed with other files natively.
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
I might be a tiny, tiny bit off with that, but it should work more or less as advertised. You should end up with $JAR.tmp containing your decompiled files.
I have had reasonable success with a tool named (frustratingly) "JD: Java Decompiler".
I have found it better than most decompilers when dealing with classes compiled for Java 5 and higher. Unfortunately, it can still have some hiccups where JAD would normally succeed.
# 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 decomplie.jar.sh //executable
ln -s ./decomplie.jar.s /usr/bin/dj
即可使用,只需输入 dj your.jar< /code> 您将获得包含源代码的 your.jar.src 文件夹。 使用 -d 选项进行调试模式。
Insert the following into 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 decomplie.jar.sh //executable
ln -s ./decomplie.jar.s /usr/bin/dj
Ready to use, just type dj your.jar and you will get your.jar.src folder with sources. Use -d option for debug mode.
Note: This solution only works for Mac and *nix users.
I also tried to find Jad with no luck. My quick solution was to download MacJad that contains jad. Once you downloaded it you can find jad in [where-you-downloaded-macjad]/MacJAD/Contents/Resources/jad.
发布评论
评论(8)
2023 年:splashout 在 评论 < code>Vineflower/vineflower 反编译器(发布),从 Quiltflower 重命名到藤花。
2022 年更新:QuiltMC/quiltflower 是最新的 最先进的 Java 反编译器:
Quiltflower 是一个现代的通用反编译器,专注于提高代码质量、速度、和可用性。
Quiltflower 是 Fernflower 和 Forgeflower 的分支。
请参阅输出示例。
或者:
2009: JavaDecompiler 可以很好地处理 jar:从 0.2.5 开始,所有文件都在 JAR 中文件,显示。
另请参阅 问题“如何“反编译”Java类文件?”。
不过,自 2009 年末以来,JD-Eclipse 似乎没有发生任何变化(请参阅更改).
因此它与最新 Eclipse(3.8、4.2+)的集成可能会出现问题。
JD-Core 得到积极维护。
两者都是(SO 用户)Emmanuel Dupuy 出色工作的成果。
2018:一个更现代的选项,中提到David Kennedy Araujo 的评论:
JetBrains/intellij-community/plugins/java-decompiler/engine
另请参阅如何反编译为java文件intellij idea了解命令与最新的 IntelliJ IDEA 一起使用。
2022 年更新:Florian Wendelborn 在 评论
2023: splashout suggests in the comments the
Vineflower/vineflower
decompiler (releases), renaming from Quiltflower to Vineflower.2022 update: QuiltMC/quiltflower is the latest most advanced Java decompiler:
Quiltflower is a modern, general purpose decompiler focused on improving code quality, speed, and usability.
Quiltflower is a fork of Fernflower and Forgeflower.
See output examples.
Or:
2009: JavaDecompiler can do a good job with a jar: since 0.2.5, All files, in JAR files, are displayed.
See also the question "How do I “decompile” Java class files?".
The JD-Eclipse doesn't seem to have changed since late 2009 though (see Changes).
So its integration with latest Eclipse (3.8, 4.2+) might be problematic.
JD-Core is actively maintained.
Both are the result of the fantastic work of (SO user) Emmanuel Dupuy.
2018: A more modern option, mentioned in the comments by David Kennedy Araujo:
JetBrains/intellij-community/plugins/java-decompiler/engine
See also How to decompile to java files intellij idea for a command working with recent IntelliJ IDEA.
2022 update: Florian Wendelborn suggests in the comments
首先,值得记住的是,所有 Java 存档文件(
.jar
/.war
/etc...)基本上都是奇特的。 zip
文件,其中添加了一些清单和元数据。其次,为了解决这个问题,我个人使用了几种在各个级别上处理这个问题的工具:
.class
文件jar
)之间进行快速比较。 非常值得一试。上述所有优点的优点是,我不需要持有任何其他外部工具来扰乱我的工作环境。 我从这些文件之一中需要的所有内容都可以在我的 IDE 中处理,或者与其他文件本地进行比较。
First of all, it's worth remembering that all Java archive files (
.jar
/.war
/etc...) are all basically just fancy.zip
files, with a few added manifests and metadata.Second, to tackle this problem I personally use several tools which handle this problem on all levels:
.class
filesjar
s. Well worth a try.The advantage of all the aforementioned, is that I do not need to hold any other external tool which clutters my work environment. Everything I will ever need from one of those files can be handled inside my IDE or diffed with other files natively.
如果你碰巧同时拥有 bash shell 和 jad:
我可能对此有点不太满意,但它应该或多或少像广告中那样工作。 您最终应该得到包含反编译文件的
$JAR.tmp
。If you happen to have both a bash shell and jad:
I might be a tiny, tiny bit off with that, but it should work more or less as advertised. You should end up with
$JAR.tmp
containing your decompiled files.我使用名为“JD: Java Decompiler”的工具(令人沮丧)取得了相当的成功。
我发现在处理为 Java 5 及更高版本编译的类时,它比大多数反编译器更好。 不幸的是,它仍然会出现一些问题,而 JAD 通常会成功。
I have had reasonable success with a tool named (frustratingly) "JD: Java Decompiler".
I have found it better than most decompilers when dealing with classes compiled for Java 5 and higher. Unfortunately, it can still have some hiccups where JAD would normally succeed.
比如:
也许?
Something like:
maybe?
将以下内容插入 decompile.jar.sh
即可使用,只需输入
dj your.jar< /code> 您将获得包含源代码的
your.jar.src
文件夹。 使用-d
选项进行调试模式。Insert the following into decompile.jar.sh
Ready to use, just type
dj your.jar
and you will getyour.jar.src
folder with sources. Use-d
option for debug mode.您提取它,然后对目录使用 jad 。
You extract it and then use jad against the dir.
注意:此解决方案仅适用于 Mac 和 *nix 用户。
我也尝试找到 Jad,但没有成功。 我的快速解决方案是下载包含 jad 的 MacJad 。 下载后,您可以在 [where-you-downloaded-macjad]/MacJAD/Contents/Resources/jad 中找到 jad。
Note: This solution only works for Mac and *nix users.
I also tried to find Jad with no luck. My quick solution was to download MacJad that contains jad. Once you downloaded it you can find jad in [where-you-downloaded-macjad]/MacJAD/Contents/Resources/jad.