2

I'm getting the following error from the eclipse debugger: local variable unavailable. Tried to trim the code as much as possible. The problem is pretty simple, I have to use the DivisiveUI UpdateLog() method, from the Divise class, using variables from the Cluster class. The Divise has a list containing all of the clusters. Divisive and DivisiveUI has a reference to each other. How can I get access to the variables: sumDistance, avgDistance from the Divisive class? Tried writing a method in the Divisive class, still couldn't access the needed variables :| Thank you!

Error crops at log.append(text+"\n"); Source Not Found.

Divisive:

   package clusters;

        import java.util.LinkedList;

        public class Divisive implements Runnable
        {
            LinkedList<Record> mainTable;
            LinkedList<Cluster> clusterList;
            int meassureType;
        DivisiveUI parent;
        int clusterCount;

        Divisive(LinkedList<Record> mainTable, DivisiveUI parent)
        {
            this.parent=parent;
            this.mainTable=new LinkedList<Record>(mainTable);
            setMeassureType(0);
        }

    }

DivisiveUI:

 package clusters;



@SuppressWarnings("serial")
public class DivisiveUI extends JPanel implements Runnable{

    ClusteringSelection parent;
    Divisive divisive;
    JTextField clusterCount;
    JTextArea log;

    public void UpdateLog(String text)
    {
        log.append(text+"\n");
        log.setCaretPosition(log.getDocument().getLength());
    }
}

Cluster:

 package clusters;


public class Cluster 
{
    LinkedList<Record> table;
    LinkedList<MatrixRow> matrix;

    LinkedList<Double> center;
    double sumDistance;
    double avgDistance;

    int meassureType;
}
3
  • 3
    What line of code causes the error? Can you show the actual full error text? Commented Apr 6, 2013 at 12:57
  • You have nowhere initialized log variable..!! Commented Apr 6, 2013 at 13:10
  • I said i snipped the code + if it wasn't initialized, i wouldn't be getting an error for a unreachable variable. Commented Apr 6, 2013 at 13:17

1 Answer 1

8

If the debugger can't acces the local variable, that means that the code hasn't been compiled with the option adding the local variable debugging information from the bytecode.

Check how you're compiling the classes, and make sure this information is in the compiled classes. If javac is used, add the -g option to ad all the debugging information.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, but I'm using the Eclipse, how can I accomplish this there?
For how to do this in Eclipse look here: stackoverflow.com/questions/5080912/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.