Jump to content
Tuts 4 You

[?] java byte code


abbas

Recommended Posts

hi

can anyone help me with compiling this piece of code?

 

 

                  public static boolean xUFT() { return true; }

        iconst_1 1
        ireturn


                  private boolean GyLP() { return true; }

        iconst_1 1
        ireturn


                  public static String xUFT(String paramString1, String paramString2) { return null; }

        aconst_null
        areturn


                 private String LCuJ() { return this.GyLP + "XXXXX"; }
                 private gIbD(String paramString1, String paramString2, int paramInt) { this.GyLP = "XXXX";
                 this.PcqR = true; }

        aload_0 0
        ldc String Constant "XXXX"
        putfield String gIbD.GyLP
        aload_0 0
        iconst_1 1
        putfield boolean gIbD.PcqR
        return


                 public static String PcqR() {return localgIbD.GyLP + " XXXX";}

        new StringBuilder
        dup
        invokespecial void StringBuilder.<init>()
        aload_0 0
        getfield String gIbD.GyLP
        invokevirtual StringBuilder StringBuilder.append(String)
        ldc String Constant " XXXXX"
        invokevirtual StringBuilder StringBuilder.append(String)
        invokevirtual String StringBuilder.toString()
        areturn

and there goes my written byte code.theres something wrong with it for sure cause the app stops when loading

Link to comment

@abbas
I would suggest you to write the code in java and then compile it.

I was trying to do just that but I can't understand, from your code, if  'GyLP' is a static or non-static field of the class and/or if it's private/public. Sometimes you refer to it with ' this.GyLP ' but, in the last method, you are accessing the field from a static method ... :wacko:

I focused on the last routine ...

A possible code ... (but you have to clarify the real situation you're facing)

// File gIbD.java  --> gIbD.class
public class gIbD {
    public String GyLP;
}


// File Class2.java --> Class2.class
public class Class2 {
    private static gIbD localgIbD = new gIbD();
    
    public static String PcqR() {
        return localgIbD.GyLP + " XXXX";
    }
}
	

will compile to:

00000000 : new                 java.lang.StringBuilder
00000003 : dup
00000004 : getstatic           gIbD Class2.localgIbD
00000007 : getfield            java.lang.String gIbD.GyLP
0000000A : invokestatic        java.lang.String java.lang.String.valueOf(java.lang.Object)
0000000D : invokespecial       void java.lang.StringBuilder.<init>(java.lang.String)
00000010 : ldc                 " XXXX"
00000012 : invokevirtual       java.lang.StringBuilder java.lang.StringBuilder.append(java.lang.String)
00000015 : invokevirtual       java.lang.String java.lang.StringBuilder.toString()
00000018 : areturn
	

Just create a small example - in java - of your classes and compile them. :)

Regards,
Tony

 

 

Edited by tonyweb
  • Like 1
Link to comment
12 hours ago, tonyweb said:

Just create a small example - in java - of your classes and compile them. :)

 

i googled it for two days and couldn't figure it out

can you refer me to a link how to do it? which compiler and deodorant compiling require libraries?! *zero experience at coding:dunno:

tried intellij but couldn't do it

Link to comment

@abbas
Just create a new project with your Java IDE (in your case IntelliJ ... I prefer Eclipse for Java, but that doesn't matter) and create your java classes (java files with a:

public class <ClassName> {
	} 

Mind that the class name has to match one-to-one the file name (public class Class1 inside "Class1.java" file).
Once you build your project, you have your *.class files ... you can decompile as you like. :)

This video seems quite complete.

https://www.youtube.com/watch?v=M0Y0T-s_mbQ

Regards,
Tony

 

 

 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...