10 Replies Latest reply: Sep 4, 2008 2:48 PM by 843785 RSS

    Decompiled JAR want to add more Floats and Recompile

    843785
      I have a Java application we use to input Advertisement Sales for a yearbook class and there are currently 8 floats for the price and type of advertisement but we need 20. I extracted the files from the JAR file with Winrar. I want to change the AdvertiseType.class file like I did here so it will allow for 20 floats and then recompile it into JAR. I tried this but once I place the JAR back in the Program Files folder and run the .exe application I get an error saying Could not find the main class. Program will exit! I checked the original Manifest file and there wasn't a Main Class line in there. Please Help!

      AdvertiseType()
      {
      id = new int[20];
      description = new String[20];
      price = new float[20];
      for(int i = 0; i < 20; i++)
      {
      id[i] = i;
      description[i] = "";
      price[i] = 0.0F;
      }
        • 1. Re: Decompiled JAR want to add more Floats and Recompile
          EJP
          I extracted the files from the JAR file with Winrar.
          Why? What's wrong with the [JAR utility|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/jar.html]?
          I get an error saying Could not find the main class.
          Probably you left the manifest file out of the Jar file altogether when you rebuilt it.

          Use the [JAR utility|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/jar.html] for this, not Winrar, and make sure you tell it about the manifest file.
          • 2. Re: Decompiled JAR want to add more Floats and Recompile
            843785
            I looked at the original manifest file and there is no trace of a Main class and the new JAR decompiled has a manifest file in it
            • 3. Re: Decompiled JAR want to add more Floats and Recompile
              843785
              Oh and I'm unfamiliar with Java I just need to configure this one application, I've never used JAR Utility
              • 4. Re: Decompiled JAR want to add more Floats and Recompile
                843785
                What do you mean "run the .exe application"? Is this an executable jar or a native executable?

                You're probably better off getting the original source code from the product, if available. And if it isn't available, find a different product, possibly an open-source one that you're free to modify.
                • 5. Re: Decompiled JAR want to add more Floats and Recompile
                  843785
                  The software is called SumIt and it runs from SumIt.exe but in the program files folder there is a JAR file called SumIt.jar. I'm assuming the SumIt.exe file runs and looks at the SumIt.jar file. When I decompiled the JAR file it showed all the classes of the program in a folder called StampGUI, and the Manifest was in META-INF. If I place the old JAR file back in it works fine. If you'd like for you to get a better understanding I can e-mail the JAR file to you so you can decompile and see.
                  • 6. Re: Decompiled JAR want to add more Floats and Recompile
                    843785
                    Oh by the way I can't get the original source files, the software is from our publisher who sub-contracts programmers.
                    • 7. Re: Decompiled JAR want to add more Floats and Recompile
                      843785
                      Chris120590 wrote:
                      The software is called SumIt and it runs from SumIt.exe but in the program files folder there is a JAR file called SumIt.jar. I'm assuming the SumIt.exe file runs and looks at the SumIt.jar file. When I decompiled the JAR file it showed all the classes of the program in a folder called StampGUI, and the Manifest was in META-INF. If I place the old JAR file back in it works fine.
                      It's possible that sumit.exe does a checksum or something on the jar file, or some other kind of validation check, and then refuses to load it if it doesn't match. Or not. It's hard to say. This is an unusual way to run a jar file.
                      • 8. Re: Decompiled JAR want to add more Floats and Recompile
                        843785
                        Chris120590 wrote:
                        Oh by the way I can't get the original source files, the software is from our publisher who sub-contracts programmers.
                        Sub-contracted developers usually produce works-for-hire, which would mean that the publisher should own the copyright and should have the source code. If the subcontractor doesn't provide the source code, they may be in violation of contract. On the other hand it's pretty typical for the entity hiring the contractors to completely miss this point, I've noticed -- the lawyers know it but nobody else in the organization does.

                        Who is this publisher? Do they answer to you? If you have some functionality you need, then make them provide it.
                        • 9. Re: Decompiled JAR want to add more Floats and Recompile
                          843785
                          The publisher is just a company out of Texas that provides the software for free, we only speak with a regional representative so it would take too long to receive it even if we can. I mean the decompiled class files should be all there I just think that somewhere along the line it doesn't need a Main-Class. Are there types of Java programs without a Main-Class declared?
                          • 10. Re: Decompiled JAR want to add more Floats and Recompile
                            843785
                            Sure. Applets for example. There has to be some kind of functionality that invokes some method to start the class's functionality running. It doesn't have to be main(); main() is just the standard way that the JVM for standalone programs. That sumit.exe obviously loads and executes something in the jar. It doesn't have to be main().

                            But that doesn't explain why it wouldn't run your changed jar, unless you changed the one method it was looking for.

                            Anyway I really think you're wasting your time. Get a different program.