将.class转换为.java [英] Convert .class to .java
问题描述
我有一些我需要转换为.java的.class文件,所以我做了:
I have some .class files that I need to convert to .java so I did:
javap -c ClassName.class
并且我一直有同样的错误
and all the time I have the same error
错误:找不到ClassName.class
ERROR:Could not find ClassName.class
你们有什么想法可能是原因?我做了man javap,据我所知,语法是正确的。如果有另一种方法将其转换为.java文件,我非常愿意尝试。非常感谢任何想法?
Do you guys have any idea of what might be the cause? I did man javap and as far as I know the syntax is correct. If there is another way to convert it to a .java file, I am more than willing to try. Any idea is greatly appreciated?
推荐答案
调用 javap
来读取字节码
javap
命令使用不带 .class $ c $的类名c>扩展名。尝试
Invoking javap
to read the bytecode
The javap
command takes class-names without the .class
extension. Try
javap -c ClassName
将.class文件转换回.java文件
javap
但不会给出你在java语法中的方法的实现。它最多只能以JVM字节码格式提供给你。
Converting .class files back to .java files
javap
will however not give you the implementations of the methods in java-syntax. It will at most give it to you in JVM bytecode format.
实际反编译(即反向执行 javac
)你将不得不使用适当的反编译器。例如,请参阅以下相关问题:
To actually decompile (i.e., do the reverse of javac
) you will have to use proper decompiler. See for instance the following related question:
- How do I "decompile" Java class files?
这篇关于将.class转换为.java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!