Eclipse调试执行Java程序而不会在断点处停止

时间:2017-11-25 07:22:00

标签: java eclipse debugging breakpoints

我是Java新手,我正在尝试调试Java代码并期望在断点处停止执行。但是我在调​​试视图中得到以下消息:

<terminated>pullData [Java Application] 
    <terminated>Core_java.Excelread at localhost:57966  
    <terminated, exit value: 0>C:\Program Files\Java\jdk1.8.0_144\jre\bin\javaw.exe (25-Nov-2017, 12:04:21 PM)  

以下是我的代码:

 import java.io.*;
 import jxl.*;

 public class Excelread {

     public static void main(String[] args) throws Throwable {
         String Filename = "C:\\library\\TestData.xls";
         String Sheetname = "Source";
         String[][] arrayExcelData = null;
         FileInputStream fis = new FileInputStream(Filename);
         Workbook WB = Workbook.getWorkbook(fis);
         Sheet SH = WB.getSheet(Sheetname);
●        SH.getColumns();
         SH.getRows();

             /* System.out.println(TotalCol +" "+ TotalRow);
             arrayExcelData = new String [TotalRow][TotalCol];
             for (int i=0; i<TotalRow; i++) {
                 for(int j=0;j<TotalCol;j++) {
                     arrayExcelData[i][j] = SH.getCell(j,i).getContents();
                     System.out.print(arrayExcelData[i][j]+ "\t");
                 }
                 System.out.println();
             }*/
     }
 }

1 个答案:

答案 0 :(得分:0)

如果设置断点并执行运行运行而不是运行调试(或通过根据工具栏按钮Run而不是Debug),忽略断点。

请参阅Help - Eclipse Platform, Launching a Java program in debug mode

BTW,所有大写变量名称(WBSH)都应该用于final个变量,即常量by convention

投掷Throwable通常没有多大意义,因为ErrorThrowable的直接子类,其描述如下:

  

ErrorThrowable的子类,表示合理的应用程序不应该试图捕获的严重问题。