gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 10:54:06 25 4
gpt4 key购买 nike

我是 Java 新手,我正在尝试调试 Java 代码并希望在断点处停止执行。但我在调试 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)

下面是我的代码:

 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();
}*/
}
}

最佳答案

如果您设置断点并执行 RunRun 而不是 Run调试(或通过相应的工具栏按钮 Run 而不是 Debug),断点将被忽略。

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

顺便说一句,所有大写变量名称(WBSH)都应该用于final变量,即仅常量by convention .

并抛出一个Throwable通常没有多大意义,因为 ErrorThrowable 的直接子类其描述如下:

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

关于java - Eclipse调试执行Java程序而不在断点处停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47483566/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com