1

I'm using Eclipse to debug a java application. To better display the internal structure of any Object, I've written a small Class named MyTool. I want to use it in the watch expression. But when I add something like "MyTool.deepToString(this)" to the watch expression, I get an error message "MyTool cannot be resolved".

Generally, I note that only the classes imported in the java source code can be used in the "watch expression". For example, if the source code contains "import java.net.URL", then something like "new URL("http://www.msn.com")" can be used in a watch expression, otherwise, a "URL cannot be resolved to a type" error is get.

Because I want to debug some other's program like JDK, I cannot add "import" sentence in its source code. I also cannot add the "import" sentence into the watch expression. For example, if I add “import java.net.URL”, it says "Syntax error on token "import", assert expected. "

Has anyone met the same problem with me? Thanks in advance.

1
  • Try with the fully qualified name of MyTool. Commented Jul 3, 2011 at 10:45

1 Answer 1

4

You should use fully qualified class names. And I think you mean Expressions view, not Watch.

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

Comments

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.