10个利用Eclipse调试Java的常见技巧

http://www.open-open.com/news/view/1ad9099

 

 

1. Conditional Breakpoint

Hope we know how to add a breakpoint. If not, just click on the left pane (just before the line number) and a breakpoint will be created. In debug perspective, ‘Breakpoints’ view will list the breakpoint created. We can add a boolean condition to it. That is, the breakpoint will be activated and execution will hold only if the boolean condition is met otherwise this breakpoint will be skipped.

10 个利用Eclipse调试Java的常见技巧

回到顶部

2. Exception Breakpoint

In Breakpoints view there is a button labeled as J! We can use that button to add a java exception based breakpoint. For example we want the program to halt and allow to debug when a NullPointerException is thrown we can add a breakpoint using this.

10 个利用Eclipse调试Java的常见技巧

回到顶部

3. Watch Point

This is one nice feature I love. When a chosen attribute is accessed or modified program execution will halt and allow to debug. Select a class variable in Outline view and from its context menu select Toggle Watchpoint. This will create a watch point for that attribute and it will be listed in Breakpoints view.

10 个利用Eclipse调试Java的常见技巧

回到顶部

4. Evaluation (Display or Inspect or Watch)

Ctrl+Shift+d or Ctrl+Shift+i on a selected variable or expression will show the value. We can also add a permanent watch on an expression/variable which will be shown in Expressions view when debug is on.

10 个利用Eclipse调试Java的常见技巧

回到顶部

5. Change Variable Values

We can change the value of a variable on the fly during debug. Choose a variable and go to Variables view and select the value, type and enter.

10 个利用Eclipse调试Java的常见技巧

回到顶部

6. Stop in Main

In Run/Debug Settings, Edit Configuration we can enable a check box that says Stop in main. If enabled when we debug a java program that launches with a main method, the execution halts at first line of main method.

10 个利用Eclipse调试Java的常见技巧

回到顶部

7. Environment Variables

Instead of going to System properties to add an environment variable, we can conveniently add it through Edit Configuration dialog box.

10 个利用Eclipse调试Java的常见技巧

回到顶部

8. Drop to Frame

This is the second best feature I love. We can just return the control to any frame in the call stack during debug. Changes made to variables will not be reset. Choose the stack level which you want to go back and restart debug from there and click the drop to frame button from debug toolbar. Eclipse is cool!

10 个利用Eclipse调试Java的常见技巧

回到顶部

9. Step Filter

When we Step Into (F5) a method we may go into external libraries (like java) and we may not need it. We can add a filter in preferences and exclude packages.

10 个利用Eclipse调试Java的常见技巧

回到顶部

10. Step Into, Over and Return

I kept this as the last point as this is the first thing to learn in debugging :-)

  • F5 – Step Into: moves to next step and if the current line has a method call the control will go into the first line of the called method.
  • F6 – Step Over: moves the control to next line. If there is a method call in the current line, it executes the method call internally and just moves the control to next line.
  • F7 – Step Return: When done from inside a method the control will move to the calling line from where the current method is invoked.
  • F8 – Move to next breakpoint.

10 个利用Eclipse调试Java的常见技巧

 

转载于:https://www.cnblogs.com/exmyth/p/4588353.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/375851.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

操作系统上机作业--创建N个线程(多线程)

ring.c: 创建N个线程,它们构成一个环 • 创建N个线程:T1、T2、T3、… TN • T1向T2发送整数1 • T2收到后将整数加1 • T2向T3发送整数2 • T3收到后将整数加1 • T3向T4发送整数3 • … • TN收到后将整数加1 • TN向T1发送整数N 实…

管理者不应该做的事

1.责备让每个人明白出错的时候要承担责任,而不是责任他,出问题要帮他认识问题,并且给他提供解决办法,先了解来龙去脉,看看是哪里出了问题,是否能避免 2.印象没有人会因为你的服装、你的车、你的财产、你的头…

台式计算机网线,台式电脑如何连接宽带_台式电脑如何连接网线

2017-03-11 21:36:28电脑直接拨号上网(有宽带账号和密码)或者自动获取IP(有帐号没密码)上方式设置见图2016-12-10 13:29:30右击网上邻居,点属性,创建一个新的连接,按照下一步下一步的步骤就可以了,然后成功之后输入你的宽带号码和…

栈的应用--汉诺塔

#include<stdio.h>void move(char x,int n,char y){printf("%d号盘 %c柱 ---> %c柱\n",n,x,y); }void hanoi(int n,char x,char y,char z){if(n1){move(x,1,z);}else{hanoi(n-1,x,z,y);move(x,n,z);hanoi(n-1,y,x,z);} }int main(){int n;char xX;char yY;c…

Linux split命令实例

曾经是否想要把一个大文件分割成多个小文件&#xff1f;比如一个5gb日志文件&#xff0c;我们需要把它分成多个小文件&#xff0c;这样我们才有可能使用普通的文本编辑器读取它。有时我们需要传输20gb的大文件到另一台服务器&#xff0c;这就需要我们把它分割成多个文件&#x…

PIC18F452之1602自定义字符

源&#xff1a;PIC18F452之1602自定义字符转载于:https://www.cnblogs.com/LittleTiger/p/4595823.html

美国计算机工程专业,美国计算机工程专业哪些学校比较好

这里有一份相对比较专业点的排名表。希望能给你当一个参考。个人建议,选择学校还是要根据自己的实际需要,以及个人情况来决定。不一定,排名最高的学校就是好的。要多多考虑一下自己的情况。如果真的需要推荐,建议楼主写出自己的情况,以及内心的想法,当然还要包括财力。2008美国…

NewCode----求数列的和

题目描述 数列的第一项为n&#xff0c;以后各项为前一项的平方根&#xff0c;求数列的前m项的和。 输入描述: 输入数据有多组&#xff0c;每组占一行&#xff0c;由两个整数n&#xff08;n < 10000&#xff09;和m(m < 1000)组成&#xff0c;n和m的含义如前所述。 输…

Hadoop源码分析7: IPC流程(1) 主要类

1.服务器端主要类 public abstractclass Server { public static final ByteBuffer HEADER ByteBuffer.wrap("hrpc".getBytes()); public static final byte CURRENT_VERSION 4; private static finalThreadLocal&#xff1c;Server&#xff1e; SERVER new ThreadLo…

html5 服务器手机编程,html5实现服务器发送事件

页面DocumentStatus:Server Datajs代码创建一个新的 EventSource 对象&#xff0c;然后规定发送更新的页面的 URL(本例中是 "demo_sse.php")每接收到一次更新&#xff0c;就会发生 onmessage 事件当 onmessage 事件发生时&#xff0c;把已接收的数据推入 id 为 "…

【动态规划】【多重背包】[HDU 1291]悼念512汶川大地震遇难同胞――珍惜现在,感恩生活...

这道题目是一个多重背包的题目&#xff0c;多重背包实际上就是把整个物品的件数拆分成a0∗20a1∗21a2∗22...an∗2n且a0或1这样每一次最优解实际上就是在之前的基础上进行的最优解的累加&#xff0c;但是发现如果物品数量不是恰好是某几个数之和&#xff0c;那么就会出现有几个…

输出字符串的比特串

48是0的ASCII码&#xff0c;49是1的ASCII码&#xff0c;char型占一个字节&#xff0c;四个比特。 #include<iostream> #include<string.h> using namespace std; string Str2Bin (char* str){int change,k0,mask8;char bit;char stack[100]{0};for (short i 0; i…

法律专业计算机基础试卷答案,大学计算机基础试题及答案

以下是小编整理的关于大学计算机基础试题及答案&#xff0c;希望对你有帮助。一、单选题1、完整的计算机系统由(C)组成。A、运算器、控制器、存储器、输入设备和输出设备B、主机和外部设备C、硬件系统和软件系统D、主机箱、显示器、键盘、鼠标、打印机2、以下软件中&#xff0c…

凭据不工作

最悲催的事情是什么&#xff1f;那就是你可以远程别人的电脑&#xff0c;但是别人不能远程自己的电脑&#xff01; 背景&#xff1a; 换了个win8.1的系统&#xff0c;刚开始可以远程上,过了几天,电脑突然不能远程了,让我很是郁闷呀. 于是在网上查了好多资料,看看他到底是什么原…

【最后的冲刺】android中excel表的导入和数据处理

【最后的冲刺】android中excel表的导入和数据处理 ——学校课程的查询和修改 1.编写 The Class类把课程表courses.db当做一个实体类&#xff0c;hashcode和equals这两个类是为了判断输入的查询内容和Excel表中的内容是否一致。 并在java里面区别两个对象是否一致 1 public clas…

详解C++函数模板

函数模板属于类属&#xff0c;能够处理不同的数据类型&#xff0c;当编译器遇到函数调用是&#xff0c;将根据实际参数的类型产生特定的代码&#xff0c;函数模板的定义形式是&#xff1a; template <类型参数表> 返回值类型 函数名&#xff08;形式参数表&#xff09;{…

计算机专业女兵,陈豪2010《点解阿Sir》剧照

0陈豪2010《点解阿Sir》剧照2012-07-21 08:24{"info": {"setname": "陈豪2010《点解阿Sir》剧照","imgsum_bk": 20,"imgsum": 20,"lmodify": "2012-07-21 08:24:00","prevue": " "…

ASP.NET MVC学习之Ajax(完结)

一.前言 通过上面的一番学习&#xff0c;大家一定收获不少。但是总归会有一个结束的时候&#xff0c;但是这个结束也意味着新的开始。 如果你是从事ASP.NET开发&#xff0c;并且也使用了第三方控件&#xff0c;那么一定会觉得ASP.NET开发ajax十分的简单&#xff0c;而ASP.NET M…

认知计算机语言学,什么是认知语言学

文献综述&#xff1a;“语文素养”内涵研究综述“语文素养”内涵研究综述摘要&#xff1a;“语文素养”是新一轮语文课程改革所提出的一个重要概念&#xff0c;其作为语文课程改革的目标与核心理念&#xff0c;挤兑了“语文能力”的核心地位。目前&#xff0c;人们对“语文素养…

data URI scheme及其应用

data URI scheme通俗来讲就是图片直接塞到HTML而不是由HTTP。这样从表面上看会降低一次HTTP的请求&#xff0c;实现了对于网页的优化&#xff08;只是看了其它一些文章data URI由于将图片採用了base 64的编码方式进行表达&#xff0c;所以还是须要进行HTTP去下载内容&#xff0…