Eclipse debug execute Java program without stopping at breakpoint

笑着哭i 提交于 2019-12-11 05:17:29

问题


I new to Java and I'm trying to debug a Java code and expecting to stop execution at breakpoint. But I get below message in my debug view:

<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)  

Below is my code:

 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:


If you set a breakpoint and perform RunRun instead of RunDebug (or via the according toolbar buttons instead of ) the breakpoint is ignored.

See Help - Eclipse Platform, Launching a Java program in debug mode.

BTW, all uppercase variable names (WB, SH) should be used for final variables, i.e. constants only by convention.

And throwing a Throwable usually doesn't make much sense, since Error is a direct subclass of Throwable and its description reads:

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.



来源:https://stackoverflow.com/questions/47483566/eclipse-debug-execute-java-program-without-stopping-at-breakpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!