CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Join Date
    Feb 2010
    Posts
    121

    How do I compile this jar file

    New to java but willing to learn.

    I discovered an excellent Scrabble game done in java called Jabble (http://domcobley.50megs.com/jabble.html)

    It works really well but I would like to make a couple of tweaks to it (i.e. make it 800 x 600 on startup without having to resize and changing some of the colours).

    So, I decomplied the jar file, made some changes and used NetBean 6.8 to do a clean and build but I get a lot of errors which I don't understand.

    I would really appreciate if somone could tell me if they can rebuild the jar or am I wasting my time as the jar file was built in 2001? If someone can rebuild it can you tell me how it is done?

    Much appreciated

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How do I compile this jar file

    Unless you tell us what errors you are getting it's hard to help without guessing.

    My guess though is the decompiler hasn't correctly decompiled the class files and therefore when you try to recompile the class files there are compile time errors.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Feb 2010
    Posts
    121

    Re: How do I compile this jar file

    I used JD Java Decompiler (http://java.decompiler.free.fr).
    The files seemed to have to decompiled ok to me, i.e. there is no corrupted text etc?
    Do you want me to upload the decompiled java files so that you can have a go yourself or do you want me to send you a debug log of one of the files - however, the errors vary from file to file? Would it be a case of a missing library?

  4. #4
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: How do I compile this jar file

    Post up the full text of the error messages - they will tell us what the problem(s) is/are.

    By viewing the old we learn the new...
    Chinese proverb
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  5. #5
    Join Date
    Feb 2010
    Posts
    121

    Re: How do I compile this jar file

    Here are the errors generated when I compile the main Jabble. I am using NetBeans 6.8

    I've also attached the source I am working with.

    Would really appreciate if someone could help me. Thanks
    Last edited by peahead; December 7th, 2010 at 04:54 PM.

  6. #6
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: How do I compile this jar file

    These are syntax errors, suggesting either the decompiler isn't handling certain code correctly, or that compiler optimisations have rendered the compiled code problematic for decompiling.

    However, I see you have cross-posted this in other forums, so I won't waste any more time on it.

    Any fool can use a computer. Many do...
    Ted Nelson
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  7. #7
    Join Date
    Feb 2010
    Posts
    121

    Re: How do I compile this jar file

    Thanks Dlorde,
    Yes, you are right. I had posted this article in two other forums but I never received any real help except for a bum steer about a missing org.apache library which, when installed, removed the errors, but I found out later to be a waste of time...hmmmm.

    Your answer is the most definitive and constructive I have received, so thanks for that. Ah well, all I was trying to do was resize the screen on startup which is no big deal.

    Cheers

  8. #8
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How do I compile this jar file

    Yes, you are right. I had posted this article in two other forums
    Bad move. Many people (generally myself included) won't answer cross posted questions because we end up wasting our time answering something that has already been answered on another forum. If you want serious help close the posts on the other forums.

    but I never received any real help except for a bum steer about a missing org.apache library which, when installed, removed the errors,
    Adding a library, any library, would not make these errors go away. As dlorde has already pointed out these are predominantly syntax errors and not problems with binding to other classes.

    Decompiling code is not as easy as you may think and it looks like, in this case, your decompiler has struggled to understand the p code. You could try using a different decompiler and see if that makes a better job of it.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  9. #9
    Join Date
    Feb 2010
    Posts
    121

    Re: How do I compile this jar file

    Ok Keang,
    Point taken - I have since closed the other cross posts. In my defence, I gave up on them due to lack of interest, so thought no harm done, but I appreciate the time wasting effort in responding to cross posts, so apologies. I wouldn't appreciate the same if it happended to me.

    I will take your advice at trying another decompiler. Any suggestions as to a free decompiler?

    Thanks again

  10. #10
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: How do I compile this jar file

    Quote Originally Posted by peahead View Post
    Any suggestions as to a free decompiler?
    I've used JAD in the past - but I've not tried to recompile from it. It seems to have died out of late, so there may be better options out there now.

    The trouble with programmers is that you can never tell what a programmer is doing until it’s too late...
    Seymour Cray
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  11. #11
    Join Date
    Feb 2010
    Posts
    121

    Re: How do I compile this jar file

    dlorde: Thanks for the pointer about JAD - it has done a much better job of decompiling the class files when compared to JD java compiler as there are less errors detected by NetBeans, however, I still have 3 class files which contain errors so the build fails but I am making progress as the preference screen kicks in at the start before it falls over.

    It falls over as the class file 'DragArea' (see attached screenshot) contains illegible code. You will see that lines 262-272 failed to decompile properly and just my luck these lines see to contain the code need to boot the main panel itself.

    Not to be beaten I checked the code decompiled by JD java compiler and it is as follows:

    {
    DragArea tmp43_42 = this;
    if ((localObject = tmp43_42.m12(tmp43_42.f7, (this.f10) ? 1 : 2)) == null)
    return;
    if (this.f10)
    this.f7.x = ((Tile)localObject).getPoint().x;
    else
    this.f7.y = ((Tile)localObject).getPoint().y;
    m9((Tile)localObject);
    if (!(this.setupMode))
    m2((Tile)localObject);
    }

    (not sure how to enter code on this site).

    I have tried (on & off) for 3 nights to 'patch' this code into the code produced by JAD but without success. Admittedly I am out of my depth. I would appreciate if someone could have a go themselves at patching the code with a view to being able to build and compile it.

    I attach a snapshot of the files I am using plus a test dictionary. If I am wasting my time with this project could someone tell me. All I want to do is to change the screen size and a few colours but if the end result is not worth the effort then I will stop while I am ahead.
    Last edited by peahead; December 7th, 2010 at 04:54 PM.

  12. #12
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: How do I compile this jar file

    Quote Originally Posted by peahead View Post
    (not sure how to enter code on this site).
    You didn't see notice my or Keang's sigs then?

    If you get errors, please post the full text of the error message and the stack trace, if present. If possible, post the section of code referred to in the error message.

    If you want truly to understand something, try to change it...
    K. Lewin
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  13. #13
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How do I compile this jar file

    Without more information this is a guess but from comparing the two code snippets it looks like the code should be:
    Code:
    {
    tile = m12(f7,  f10 ? 1 : 2);
    
    if ( tile == null )
        return;
    
    if ( f10 )
        f7.x = tile.getPoint().x;
    else
        f7.y = tile.getPoint().y;
    
    m9(tile);
    
    if ( !setupMode )
        m2(tile);
    }
    You may also need to declare the variable 'tile' (I can't see from the code you've posted if it is already declared).
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  14. #14
    Join Date
    Feb 2010
    Posts
    121

    Re: How do I compile this jar file

    Thanks for your help keang.

    Your code has removed the errors on the java file 'DragArea' (thanks!) but I am still unable to compile the project as 2 other java files 1) Jabble and 2) Toolbarframe contains errors

    1) Jabble.java

    NetBean 6.8 stops compiling at line 649 on Jabble.java; this is the relevant error:

    Listening on javadebug
    User program running
    Debugger stopped on uncompilable source code.
    Thread main stopped at Jabble.java:649.


    The code at line 649 reads as follows:

    Code:
     f2 = new DragArea();
    When I hover over the line with the mouse it says cannot find symbol
    symbol: constructor DragArea
    location: class DragArea

    Also, in the Jabble file NetBeans finds errors in the following code (line 2 and 5 respectively) saying variable tmp31_30 might not have been intialized

    Code:
            {
                problemField.setText(s);
                    Jabble tmp31_30 = tmp31_30; 
        if (tmp31_30 == null)
          throw null;
        new Jabble.Reminder(tmp31_30, 3);
                return;
            }
    2) Toolbarframe.java

    This file contains 42 errors mainly surrounding 'package super does not exist'

    Any suggestions?

    I attach another screenshot for reference.

    Again, thanks for your time and help
    Last edited by peahead; December 7th, 2010 at 04:54 PM.

  15. #15
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How do I compile this jar file

    NetBean 6.8 stops compiling at line 649 on Jabble.java; this is the relevant error:

    Listening on javadebug
    User program running
    Debugger stopped on uncompilable source code.
    Thread main stopped at Jabble.java:649.
    That's not a compiler message, it looks like output from running the program.

    You need to look at the DragArea class, see what constructors it has and use the most appropriate one. It probably should be:
    Code:
    f2 = new DragArea(this);
    Also, in the Jabble file NetBeans finds errors in the following code (line 2 and 5 respectively) saying variable tmp31_30 might not have been intialized
    Can you show the output from both decompilers.

    This file contains 42 errors mainly surrounding 'package super does not exist'
    This file imports a file (com.symbian.devnet.util.ELocale), do you have this file - it could be in another jar.

    Try removing the package declaration and make sure the jar containing the imported file is on the class path.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured