当前位置:网站首页>Decompile jar files (idea environment)

Decompile jar files (idea environment)

2022-07-26 19:52:00 xsqsharp

explain

Want to be right about some jar Decompile files , Because now IDEA More people use it , The more convenient way is , have access to IDEA Decompile the plug-ins in .

IDEA plug-in unit

have access to IDEA Medium "Java Bytecode Decompiler", This plug-in is generally built-in , You can use it directly . Find the location of the plug-in .

  • Java Bytecode Decompiler Location :D:\DevTools\JetBrains\IntelliJ IDEA 2021.1\plugins\java-decompiler\lib\java-decompiler.jar

  • To decompile jar Bag location :F:\javadecom\helloworld.jar

Open console , Enter the to decompile jar In the directory of the package , Decompile command :

java -cp "D:/DevTools/JetBrains/IntelliJ IDEA 2021.1/plugins/java-decompiler/lib/java-decompiler.jar" org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -dgs=true F:/javadecom/helloworld.jar data

explain

  • org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler: Is the startup class of the plug-in .

  • data: Is to decompile jar A folder under the package path , It needs to be created in advance , The decompiled results will be placed in this folder .

Carry out orders , An error appears , As shown in the figure below :

Error details :

F:\javadecom>java -cp "D:/DevTools/JetBrains/IntelliJ IDEA 2021.1/plugins/java-decompiler/lib/java-decompiler.jar" org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -dgs=true F:/javadecom/helloworld.jar data

Error: A JNI error has occurred, please check your installation and try again

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

intend JDK11 Compiled code , Can't use JDK8 Decompile .

You need to download one JDK11, After the download , You can specify the use of JDK11 decompile .

  • JDK11 Location :D:\DevTools\Java\jdk-11.0.12\bin\java.exe

Specify the use of JDK11 Decompile command :

D:/DevTools/Java/jdk-11.0.12/bin/java.exe -cp "D:/DevTools/JetBrains/IntelliJ IDEA 2021.1/plugins/java-decompiler/lib/java-decompiler.jar" org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -dgs=true F:/javadecom/helloworld.jar data

After decompilation , Will be in data Generate... In directory jar Decompiled file .

Extract the file , Is decompiled code .

原网站

版权声明
本文为[xsqsharp]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/207/202207261825577510.html