Decompile JAVA DLL

白昼怎懂夜的黑 提交于 2020-01-03 05:33:14

问题


I've received a java dll file with an app I've downloaded. This DLL file was written in Java and now I want to decompile it.

Here is how I call this dll that contains a jar:

new JarInputStream(getClass().getResourceAsStream("jarjava.dll"));

Is there a way to decompile it?


回答1:


Java source files are compiled to .class files. As far as I know, there is no standard way to compile java code to a DLL.

What could have happened here:

  • This is C code written against the JNI API, to be used to interact with (or from) Java code;
  • This is Java code that was (automatically) converted to C code by some tool, and then compiled to a DLL.
  • This is a JAR file that someone renamed to a DLL. In that case, rename it back, unzip the JAR, and decompile the JAR with a Java decompiler.

Without knowing something about the origin of this DLL, there's not much you can do. Try a C decompiler, but probably won't get very far.




回答2:


You can read the machine code and translate it back into C yourself. Its not easy as the the whole point (possibly only point) of compiling the code to native is to make it harder to decompile.




回答3:


Problem solved.

Here it how I did it:

Read the file:

JarInputStream input = new JarInputStream(getClass().getResourceAsStream("/myjar.dll"));

Write a new file for each entry:

JarEntry entry;
while ((entry = input.getNextJarEntry()) != null)
{
    // Write file
}


来源:https://stackoverflow.com/questions/10171295/decompile-java-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!