Java dekompilieren

Die Umgebung ist Ubuntu 16.04

Die Quelle der Klassendatei, die ich vor ungefähr 10 Jahren erstellt habe, fehlt, also habe ich sie dekompiliert.

jad

"Klasse mit jad dekompilieren" http://qiita.com/Takmiy/items/0c968aab8460d93166b0

Versuche zu sehen


Jad 1.5.8e for Linux on Intel platform (214917 bytes).
Jad 1.5.8e for Linux (statically linked) (389972 bytes) - take this version if the one above crashes or displays the "seek error" message.

Nach dem Herunterladen und Ausführen der oben genannten


./jad: error while loading shared libraries: libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory

Laden Sie Folgendes herunter und führen Sie es aus. Versuchen Sie, ../PDFConverter.class zu kompilieren.


$ ./jad ../PDFConverter.class 
Parsing ../PDFConverter.class...The class file version is 49.0 (only 45.3, 46.0 and 47.0 are supported)
 Generating PDFConverter.jad
Overlapped try statements detected. Not all exception handlers will be resolved in the method main
Couldn't fully decompile method main
Couldn't resolve all exception handlers in method main

Ah, (nur 45.3, 46.0 und 47.0 werden unterstützt) ist out. Ich dachte, es würde nicht funktionieren, aber eine Datei namens PDFConverter.jad wurde erstellt.


$ head -30 PDFConverter.jad 
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   PDFConverter.java

import com.sun.star.beans.PropertyValue;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XStorable;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XCloseable;
import java.io.File;

public class PDFConverter
{

    public PDFConverter()
    {
    }

    public static void main(String args[])
    {
        String s = convertToURL(args[0]);
        String s1 = getFilterName(args[0]);
        String s2 = s.replaceAll("\\..{3}\\Z", ".pdf");
        XComponentContext xcomponentcontext = Bootstrap.bootstrap();
        XMultiComponentFactory xmulticomponentfactory = xcomponentcontext.getServiceManager(); 

jd-gui

http://jd.benow.ca/ Hier herunterladen

Da der Screenshot Windows ist, hatte ich ein schlechtes Gefühl, aber ich bin mit Multi-Plattform erleichtert. Laden Sie jd-gui_1.4.0-0_all.deb herunter.


$ sudo dpkg -i jd-gui_1.4.0-0_all.deb 
[sudo]nanbuwks Passwort: 
Zuvor nicht ausgewähltes Paket jd-GUI ist ausgewählt.
(Datenbank wird geladen...Derzeit sind 793826 Dateien und Verzeichnisse installiert.)
jd-gui_1.4.0-0_all.Vorbereiten der Bereitstellung von deb...
jd-gui (1.4.0-0)Wird bereitgestellt...
jd-gui (1.4.0-0)Ist eingestellt...

Rufen Sie JD-GUI von Dash of Unity aus auf und führen Sie es aus

image

Ich hab es gut gemacht.

Vergleich


$ diff PDFConverter.jad ../PDFConverter-jdgui.java 
1,5d0
< // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
< // Jad home page: http://www.geocities.com/kpdus/jad.html
< // Decompiler options: packimports(3) 
< // Source File Name:   PDFConverter.java
< 
19,20c14,16
< 
<     public PDFConverter()
---
>   public static void main(String[] paramArrayOfString)
>   {
>     try
21a18,61
>       String str1 = convertToURL(paramArrayOfString[0]);
>       String str2 = getFilterName(paramArrayOfString[0]);
>       String str3 = str1.replaceAll("\\..{3}\\Z", ".pdf");
>       
>       XComponentContext localXComponentContext = Bootstrap.bootstrap();
>       XMultiComponentFactory localXMultiComponentFactory = localXComponentContext.getServiceManager();
>       
>       Object localObject1 = localXMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", localXComponentContext);
>       
>       XComponentLoader localXComponentLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, localObject1);
>       
>       PropertyValue[] arrayOfPropertyValue = new PropertyValue[2];
>       
>       arrayOfPropertyValue[0] = new PropertyValue();
>       arrayOfPropertyValue[0].Name = "Hidden";
>       arrayOfPropertyValue[0].Value = new Boolean(true);
>       arrayOfPropertyValue[1] = new PropertyValue();
>       arrayOfPropertyValue[1].Name = "ReadOnly";
>       arrayOfPropertyValue[1].Value = new Boolean(true);
>       
>       XComponent localXComponent1 = localXComponentLoader.loadComponentFromURL(str1, "_blank", 0, arrayOfPropertyValue);
>       
>       arrayOfPropertyValue[0] = new PropertyValue();
>       arrayOfPropertyValue[0].Name = "FilterName";
>       arrayOfPropertyValue[0].Value = str2;
>       arrayOfPropertyValue[1] = new PropertyValue();
>       arrayOfPropertyValue[1].Name = "Overwrite";
>       arrayOfPropertyValue[1].Value = new Boolean(true);
>       
>       XStorable localXStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, localXComponent1);
>       
>       localXStorable.storeToURL(str3, arrayOfPropertyValue);
>       
>       XCloseable localXCloseable = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, localXStorable);
>       if (localXCloseable != null)
>       {
>         localXCloseable.close(false);
>       }
>       else
>       {
>         XComponent localXComponent2 = (XComponent)UnoRuntime.queryInterface(XComponent.class, localXStorable);
>         
>         localXComponent2.dispose();
>       }
23,24c63
< 
<     public static void main(String args[])
---
>     catch (Exception localException)
26,69c65,66
<         String s = convertToURL(args[0]);
<         String s1 = getFilterName(args[0]);
<         String s2 = s.replaceAll("\\..{3}\\Z", ".pdf");
<         XComponentContext xcomponentcontext = Bootstrap.bootstrap();
<         XMultiComponentFactory xmulticomponentfactory = xcomponentcontext.getServiceManager();
<         Object obj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.Desktop", xcomponentcontext);
<         XComponentLoader xcomponentloader = (XComponentLoader)UnoRuntime.queryInterface(com/sun/star/frame/XComponentLoader, obj);
<         PropertyValue apropertyvalue[] = new PropertyValue[2];
<         apropertyvalue[0] = new PropertyValue();
<         apropertyvalue[0].Name = "Hidden";
<         apropertyvalue[0].Value = new Boolean(true);
<         apropertyvalue[1] = new PropertyValue();
<         apropertyvalue[1].Name = "ReadOnly";
<         apropertyvalue[1].Value = new Boolean(true);
<         XComponent xcomponent = xcomponentloader.loadComponentFromURL(s, "_blank", 0, apropertyvalue);
<         apropertyvalue[0] = new PropertyValue();
<         apropertyvalue[0].Name = "FilterName";
<         apropertyvalue[0].Value = s1;
<         apropertyvalue[1] = new PropertyValue();
<         apropertyvalue[1].Name = "Overwrite";
<         apropertyvalue[1].Value = new Boolean(true);
<         XStorable xstorable = (XStorable)UnoRuntime.queryInterface(com/sun/star/frame/XStorable, xcomponent);
<         xstorable.storeToURL(s2, apropertyvalue);
<         XCloseable xcloseable = (XCloseable)UnoRuntime.queryInterface(com/sun/star/util/XCloseable, xstorable);
<         if(xcloseable != null)
<         {
<             xcloseable.close(false);
<         } else
<         {
<             XComponent xcomponent1 = (XComponent)UnoRuntime.queryInterface(com/sun/star/lang/XComponent, xstorable);
<             xcomponent1.dispose();
<         }
<         System.exit(0);
<         break MISSING_BLOCK_LABEL_321;
<         Exception exception;
<         exception;
<         exception.printStackTrace();
<         System.exit(1);
<         System.exit(0);
<         break MISSING_BLOCK_LABEL_321;
<         Exception exception1;
<         exception1;
<         System.exit(0);
<         throw exception1;
---
>       localException.printStackTrace();
>       System.exit(1);
71,73c68
< 
<     private static String convertToURL(String s)
<         throws Exception
---
>     finally
75,78c70
<         File file = new File(s);
<         StringBuffer stringbuffer = new StringBuffer("file:///");
<         stringbuffer.append(file.getCanonicalPath().replace('\\', '/'));
<         return stringbuffer.toString();
---
>       System.exit(0);
80,99c72,97
< 
<     private static String getFilterName(String s)
<         throws Exception
<     {
<         String s1 = s.substring(s.length() - 4).toLowerCase();
<         String s2 = "";
<         if(s1.equals(".doc") || s1.equals(".dot") || s1.equals(".sxw") || s1.equals(".stw") || s1.equals(".odt") || s1.equals(".ott"))
<             s2 = "writer_pdf_Export";
<         else
<         if(s1.equals(".xls") || s1.equals(".xlt") || s1.equals(".sxc") || s1.equals(".stc") || s1.equals(".ods") || s1.equals(".ots"))
<             s2 = "calc_pdf_Export";
<         else
<         if(s1.equals(".ppt") || s1.equals(".pot") || s1.equals(".sxi") || s1.equals(".sti") || s1.equals(".odp") || s1.equals(".otp"))
<             s2 = "impress_pdf_Export";
<         else
<         if(s1.equals(".sxd") || s1.equals(".std") || s1.equals(".odg") || s1.equals(".otg"))
<             s2 = "draw_pdf_Export";
<         else
<             throw new Exception("There is no corresponding filter.");
<         return s2;
---
>   }
>   
>   private static String convertToURL(String paramString)
>     throws Exception
>   {
>     File localFile = new File(paramString);
>     StringBuffer localStringBuffer = new StringBuffer("file:///");
>     localStringBuffer.append(localFile.getCanonicalPath().replace('\\', '/'));
>     return localStringBuffer.toString();
>   }
>   
>   private static String getFilterName(String paramString)
>     throws Exception
>   {
>     String str1 = paramString.substring(paramString.length() - 4).toLowerCase();
>     String str2 = "";
>     if ((str1.equals(".doc")) || (str1.equals(".dot")) || (str1.equals(".sxw")) || (str1.equals(".stw")) || (str1.equals(".odt")) || (str1.equals(".ott"))) {
>       str2 = "writer_pdf_Export";
>     } else if ((str1.equals(".xls")) || (str1.equals(".xlt")) || (str1.equals(".sxc")) || (str1.equals(".stc")) || (str1.equals(".ods")) || (str1.equals(".ots"))) {
>       str2 = "calc_pdf_Export";
>     } else if ((str1.equals(".ppt")) || (str1.equals(".pot")) || (str1.equals(".sxi")) || (str1.equals(".sti")) || (str1.equals(".odp")) || (str1.equals(".otp"))) {
>       str2 = "impress_pdf_Export";
>     } else if ((str1.equals(".sxd")) || (str1.equals(".std")) || (str1.equals(".odg")) || (str1.equals(".otg"))) {
>       str2 = "draw_pdf_Export";
>     } else {
>       throw new Exception("There is no corresponding filter.");
100a99,100
>     return str2;
>   }

Recommended Posts

Java dekompilieren
JAVA-Dekompilierung (Dekompilierung)
Java
Java
Java lernen (0)
Java studieren ―― 3
[Java] -Array
Java geschützt
[Java] Anmerkung
[Java] Modul
Java-Array
Java studieren ―― 9
Java Scratch Scratch
Java-Tipps, Tipps
Java-Methoden
Java-Methode
Java (Konstruktor)
Java-Array
Java (überschreiben)
Java (Methode)
Java Day 2018
Java-Zeichenfolge
Java statisch
Java-Serialisierung
Java Anfänger 4
JAVA hat bezahlt
Java studieren ―― 4
Java (gesetzt)
[Java] compareTo
Java studieren -5
Java reflektierend 获 获 举
Java (Schnittstelle)
Java-Memorandum
Java-Array
[Java] Array
Java # 0 studieren
Java-Überprüfung
Java-Framework
Java-Funktionen
[Java] Vererbung
FastScanner Java
Java-Funktionen
Java Anfänger 3
Java-Memo
Java-Vererbung
[Java] Überladung
Java-Grundlagen
[Java] Anmerkung
Java Note
Java Anfänger
Java (add2)
JAVA (Karte)
[Java] -Schnittstelle
Java9-Sammlung
Java-Grundlagen
So dekompilieren Sie eine Java-Klassendatei
Java-Methoden
Java-Tagebuch
Java-Vererbung
[Java] enum (Aufzählungstyp)