Results 1 to 6 of 6
  1. #1
    kuttam is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Eclipse Debugging Help

    Hello,

    I am new to Java and Eclipse. So please forgive me if my question seems dumb.

    I am working on an application. While debugging I come across some .class files. The Variables window in Debug perspective only shows me the value of method arguments and class static variables. Is there any way I can see the value of local variables in the Methods.

    I am using Eclipse Helios 3.6.2 on Fedora 15.

    TIA

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,846
    Rep Power
    19

    Default Re: Eclipse Debugging Help

    It won't show method local variables until you have reached them while debugging.
    Java Code:
    void someMethod() {
        int i = 0;
        int j = 1;
        System.out.println("I'm here");
        int k = 2;
    }
    If you were stopped on the println() call then i and j would be visible in the debugger, but k wouldn't since it doesn't exist yet.

    Or is that not the situation?

  3. #3
    kuttam is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Re: Eclipse Debugging Help

    Yes, I understand that it wont show the local variables until the debugger reaches them. But I am not able to see local variables even after that.

    Is it because I am debugging a .class file? I have installed a decompiler but nothing changed

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,846
    Rep Power
    19

    Default Re: Eclipse Debugging Help

    You'd be surprised what some people expect...:)

    If you don't have the source then (and I can't remember if this is the case for Eclipse) you won't see anything during execution of the method.
    All debugging is done against a class (ie compiled) code, since it's that that is running.
    It's possible the code was compiled with no debugging set?

  5. #5
    kuttam is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Re: Eclipse Debugging Help

    :) I was afraid I would come out like an idiot.

    Ok, so I checked out the source of the .class files. How do I compile the code with debugging on? I know how to do it from command prompt, but can you tell me how can I do that using eclipse.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,846
    Rep Power
    19

    Default Re: Eclipse Debugging Help

    Just don't give it any extra compilation switches. It compiles with debug by default, you have to tell it not to (-g:none I think, or something like that).
    It's also possible I'm barking up the wrong tree, as I can't see what you can...:)

Similar Threads

  1. Debugging with Eclipse 3.4.0
    By edcaru in forum New To Java
    Replies: 2
    Last Post: 11-07-2008, 06:27 AM
  2. Debugging Java Application in Eclipse IDE
    By JavaForums in forum Eclipse
    Replies: 0
    Last Post: 05-22-2007, 09:34 PM

Posting Permissions

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