- 浏览: 31553 次
- 性别:
- 来自: 厦门
最新评论
Logical Structure
The logical structure is very handy for examining things like maps and other java collections classes, instead of showing the full detail of all the internal variables the view will only show the “logical” pieces. It is activated/deactivated from “Variables” view using logical structure toggle button.
[Code Sample]
[Logical Structure - Deactivated]
[Logical Structure - Activated]
Conditional Debugging
Once you know where an error occurs, you will want to see what the program is doing right before it crashes. One way to do this is to step through every statement in the program, one at a time, until you reach the point of concern. Sometimes it’s better to just run a section of code and stop execution at that point so you can examine data at that location. It’s possible to declare conditional breakpoints triggered whenever the value of an expression changes. In addition, code assist is available when typing in the conditional expression.
Right click your breakpoint and select Breakpoint Properties… to set a condition. Check “Enable Condition” box and write your expression below it. You can define a “hit count” that stops your code after that count is reached if you want.
[Conditional Debugging]
Java Exception Breakpoint
Use “Java Exception Breakpoint” feature to track your exceptions more easily. For example, your program might be throwing a NullPointerException or FileNotFoundException and you want to track it down. Rather than go to the line of code and set a breakpoint, you can specify that the debugger should always stop when the exception occurs.
[Java Exception Breakpoint]
Step Filtering
“Step Into” is one of the most used feature while debugging the source code. Sometimes, it takes us through several stack traces to reach the code we want to debug. In such cases, “Step with Filters” functionality can help us. It simply filters out the classes that we don’t want to step into.
To specify which classes to filter out when “Step with Filters” is used, the preferences must be set. To activate the preferences panel choose Window > Preferences from the main window. Once there navigate to Java > Debug > Step Filtering and choose the classes/packages to be filtered out. When you step through the code, ensure that the “Use Step Filters” toggle button in Debug view is on.
[Step Filtering - Selecting Classes]
[Step Filtering - Activate Step Filtering]
Expression Evaluation
“Inspect” is a handy feature for evaluating your expressions. In the Debug perspective, select your expression, right click it and select “Inspect” from the menu to evaluate. You can do it by simply Ctrl+Shift+I key combination.
“Display View” is another efficient helper in evaluating expressions. Activate it from Window > Show View > Display, write your expressions to evaluate and execute them by right clicking and selecting “Display” from the context menu in the Debug perspective or simply by Ctrl+Shift+D shortcut. You can use code assist (Ctrl+Space) to compose your expressions.
The logical structure is very handy for examining things like maps and other java collections classes, instead of showing the full detail of all the internal variables the view will only show the “logical” pieces. It is activated/deactivated from “Variables” view using logical structure toggle button.
[Code Sample]
[Logical Structure - Deactivated]
[Logical Structure - Activated]
Conditional Debugging
Once you know where an error occurs, you will want to see what the program is doing right before it crashes. One way to do this is to step through every statement in the program, one at a time, until you reach the point of concern. Sometimes it’s better to just run a section of code and stop execution at that point so you can examine data at that location. It’s possible to declare conditional breakpoints triggered whenever the value of an expression changes. In addition, code assist is available when typing in the conditional expression.
Right click your breakpoint and select Breakpoint Properties… to set a condition. Check “Enable Condition” box and write your expression below it. You can define a “hit count” that stops your code after that count is reached if you want.
[Conditional Debugging]
Java Exception Breakpoint
Use “Java Exception Breakpoint” feature to track your exceptions more easily. For example, your program might be throwing a NullPointerException or FileNotFoundException and you want to track it down. Rather than go to the line of code and set a breakpoint, you can specify that the debugger should always stop when the exception occurs.
[Java Exception Breakpoint]
Step Filtering
“Step Into” is one of the most used feature while debugging the source code. Sometimes, it takes us through several stack traces to reach the code we want to debug. In such cases, “Step with Filters” functionality can help us. It simply filters out the classes that we don’t want to step into.
To specify which classes to filter out when “Step with Filters” is used, the preferences must be set. To activate the preferences panel choose Window > Preferences from the main window. Once there navigate to Java > Debug > Step Filtering and choose the classes/packages to be filtered out. When you step through the code, ensure that the “Use Step Filters” toggle button in Debug view is on.
[Step Filtering - Selecting Classes]
[Step Filtering - Activate Step Filtering]
Expression Evaluation
“Inspect” is a handy feature for evaluating your expressions. In the Debug perspective, select your expression, right click it and select “Inspect” from the menu to evaluate. You can do it by simply Ctrl+Shift+I key combination.
“Display View” is another efficient helper in evaluating expressions. Activate it from Window > Show View > Display, write your expressions to evaluate and execute them by right clicking and selecting “Display” from the context menu in the Debug perspective or simply by Ctrl+Shift+D shortcut. You can use code assist (Ctrl+Space) to compose your expressions.
发表评论
-
装饰模式与代理模式的区别(转载)
2013-04-22 11:28 613学习AOP时,教材上面都说使用的是动态代理,可是在印 ... -
《转》用JPDA轻松调试Java代码
2012-12-05 10:09 669在无法访问运行中的实例时,调试一个Java程序可能相当麻烦;当 ... -
《转》Java入门-高手对 CLASSPATH 的详解
2012-12-05 09:54 0Java入门-高手对 CLASSPATH 的详解 来源: 作者 ... -
java并发中Lock和Synchronized的异同
2011-11-27 14:15 7795java中可以使用Lock和Synchronized的可以实现 ... -
《转》再说final变量
2011-11-23 09:36 741再说final变量 分类: 【 ... -
<转>XFire生火指南(下)
2011-11-09 13:44 786<转>XFire生火指南(下) 请先阅读:XFi ... -
myeclipse7.0注册码算法
2011-09-19 21:25 829package com.edj.sessionbean; ... -
(转)cursor 与refcursor及sys_refcursor的区别
2011-09-14 08:56 0(转)cursor 与refcursor及sys_refcur ... -
BigDecimal不整除的一个异常
2011-09-13 09:37 2864BigDecimal不整除的一个异 ... -
(转)由MyEclipse内存不足谈谈JVM内存
2011-09-06 09:07 703原文出处: http://www.javatang.com/a ... -
Property文件的六种读取发放
2011-08-26 16:41 1106Java读取properties文件 【转】 使用J2SE ... -
tomcat端口被占用
2011-08-25 16:02 796关于tomcat端口占用的问题,怎么在myeclipse中启动 ... -
java中标签跳转
2011-08-23 14:02 1020continue语句 1.continue语句用来结束本次 ... -
java一些书籍
2011-08-23 08:56 800深入理解java虚拟机 第二版 深入理解Java虚拟机:JVM ... -
主从表中从主表保存修改的子表
2011-08-22 18:09 1128我们从数据库中查出主表Class,连带它的子表Set<S ... -
java序列化深度克隆
2011-08-18 09:24 784publicObject copy() throwsI ...
相关推荐
#### 三、Debug技巧 ##### 3.1 设置断点 断点的设置是调试的基础。在Eclipse中,只需在想要暂停执行的代码行左侧单击即可设置断点。断点图标通常为红色的小圆点。 ##### 3.2 调试程序 - **3.2.1 调试本地Java...
【Eclipse Debug调试技巧详解】 Eclipse作为一款强大的Java集成开发环境,其强大的调试功能是开发者不可或缺的工具。本文将详细介绍Eclipse中的调试视图及其常用功能,帮助开发者提升调试效率。 1. **Debug视图** ...
在Eclipse中使用debug是软件开发中调试代码的一个重要环节,尤其对于Java开发者来说,Eclipse作为一个成熟的集成开发环境,提供了强大的调试工具和技巧。尽管图像内容无法直接查看,但是根据标题和描述,我们可以...
### Eclipse中的Debug技巧详解 #### 一、概述 在软件开发过程中,调试是必不可少的一环。Eclipse作为一款广泛使用的集成开发环境(IDE),提供了丰富的调试功能,可以帮助开发者高效地定位和解决代码中的问题。...
本文将详细介绍Eclipse调试中的几个常用技巧,包括条件断点、变量断点、方法断点、改变变量值、重新调试、远程调试以及异常断点。 1、条件断点:条件断点允许我们在代码执行时设置特定条件,只有当条件满足时,程序...
### Eclipse的Debug调试技巧详解 #### 一、Debug视图概览 Eclipse IDE 提供了一个强大的调试工具,可以帮助开发者高效地找出并修复程序中的错误。本文将详细讲解Eclipse中Debug视图的功能及其使用技巧。 #### 二...
本文将深入探讨Eclipse的调试技巧,帮助您从入门到熟练掌握Eclipse的Debug功能。 首先,让我们了解Eclipse调试器。Eclipse调试器是Eclipse IDE中的核心组件之一,它允许开发者对Java应用程序进行逐步执行、查看变量...
### Eclipse Debug 技巧详解 #### 一、概述 在软件开发过程中,调试是不可或缺的一环,它能够帮助开发者快速定位并解决问题。Eclipse作为一款流行的集成开发环境(IDE),提供了丰富的调试工具来辅助开发者进行...
Eclipse Debug 调试技巧总结 Eclipse Debug 调试是一种实用的Java调试技巧,主要用于Eclipse操作讲述,讲述了多种调试技巧。下面是对Eclipse debug 调试的详细介绍: 一、断点调试 断点是调试中最基本的概念。在...
Eclipse 调试常用技巧 Eclipse 是一个功能强大的集成开发环境(IDE),它提供了许多实用的调试功能,以帮助开发者快速定位和解决问题。以下是 Eclipse 中一些常用的调试技巧: 1. 条件断点 条件断点顾名思义,...
5. **Resume (F8)**:当你希望继续执行程序直到遇到下一个断点时,可以使用Resume。在调试过程中,如果发现某个断点不再需要,可以移除它,然后使用Resume,程序会跳过已移除的断点并继续执行。 6. **Hit Count**...
标题 "liferay tomcat eclipse debug" 暗示了我们正在讨论如何在Eclipse环境中调试Liferay Portal,这是一个基于Java的开源企业级内容管理和协作平台,通常与Apache Tomcat这样的Servlet容器结合使用。以下是关于这...
#### 五、Eclipse Debug技巧 - **管理断点**:建议在每次调试结束时清除所有断点,以避免积累过多的断点影响性能。可以通过“Breakpoints”视图来管理和删除断点。 - **监控变量**:对于频繁变化的变量,应定期清理...
本文将详细介绍Eclipse Debug视图的各种功能和技巧,使开发人员能够更好地掌握Debug技巧,提高开发效率和质量。 一、Debug视图简介 Debug视图是Eclipse中最常用的窗口之一,主要显示当前线程方法调用栈、代码行数...
本文将深入探讨"EclipseDebug技巧"这一主题,帮助开发者提高工作效率,解决编程过程中遇到的问题。 首先,理解Eclipse调试器的基本操作至关重要。在Eclipse中,你可以通过点击工具栏上的"Debug"按钮或使用快捷键...
此时,Eclipse的工作界面将切换为Debug Perspective。 #### 进行调试 在Debug Perspective下,可以按照以下步骤开始调试: 1. 选择菜单栏中的【Run】->【Debug…】。 2. 设置完成后,点击【Debug】按钮开始调试。...