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.pswp.cn/news/375851.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/375851.shtml
英文地址,請注明出處:http://en.pswp.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…