3 Replies Latest reply: Dec 6, 2006 10:47 AM by 843829 RSS

    class structure

    843829
      I have two java class files which are about 1MB in size. When I decompile them I get a file of size about 30KB. When these classes are run they show an iconified frame, but there is no icon in the folder (The class has been copied to a new location). It seems that the class has embedded files in it.
      How can this embedding of files be done?

      If this is not appropriate forum, please suggest where should I post his topic.
      Thanks.
        • 1. Re: class structure
          843829
          Class files don't have embedded files in them.

          There's a few possibilities,

          1. A default icon is provided by Java
          2. They have embedded a bitmap, as an array of bytes, into the Java code itself.
          3. The icon is on the classpath somewhere, and is being picked up from there. and not your new location.

          regards,
          Owen
          • 2. Re: class structure
            843829
            Well omcgovern, you have very well highlighted some possibilities. Keeping the icon topic aside, I would like to remind you about the size of the class - IMB and decompiled source code - 30KB.
            1. A default icon is provided by Java
            3. The icon is on the classpath somewhere, and is
            being picked up from there. and not your new
            location.
            I tried to run the class on a variety of environments, and that is why I am sure that the icon is somewhere in the class.
            2. They have embedded a bitmap, as an array of bytes,
            into the Java code itself.
            This is something I also thought, but the array should have been visible somewhere in the class.

            The class shows a JFrame, buttons,dialogs and other such swing components. I searched the class byte code for methods like setVisible(), JFrame, javax.. I could not find a sign of swing!

            The class might have been obfuscated. But decompilers show errors while decompiling an obfuscated class, I don't remember any although I have tried two or three decompilers.

            I think, as you said, the resources might be in an array in the class. They might have been kept encrypted, and decrypted on execution. The class (that I am talking about) extends ClassLoader. So it seems quiet possible that the class uses loadClass(byte[]b,...)method to load the classes associated with the GUI items. And perhaps it may be hidden or/as well as obfuscated. So the the topic of this thread may be latent arrays!

            If you ask, I can give you the class file and the decompiled source for your periusal.
            Please do reply.
            Thanks.
            • 3. Re: class structure
              843829
              Thread moved to:
              http://forum.java.sun.com/thread.jspa?threadID=792867