[英]Eclipse debugger is blank (source not found)
我試圖調試以下代碼,我在行w= w+ inputString.substring(firsti,i)+"yay";
但是調試器顯示空白(找不到源)這是怎么回事?
public String translate (String inputString)
{
String w = "";
int firsti =0;
for(int i=0; i< inputString.length(); i++){
if(isVowel(inputString.charAt(i))){
firsti = i;
while (inputString.charAt(i) != ' ' || i< inputString.length()){
i++;
}
w= w+ inputString.substring(firsti,i)+"yay";
System.out.println(w);
}
}
String outputString = new String(inputString); // Copies input to output and prints it.
return outputString;
}
您可能正在嘗試進入Java API內的substring()
方法。 您需要附加Java源代碼來調試substring()
如何附加來源:
轉到項目>屬性> Java構建路徑>庫,然后展開JRE系統庫JRE版本rt.jar。 選擇源附件,單擊編輯...。 選擇源代碼文件(外部文件…),然后按確定
閱讀此鏈接以獲取更多信息。
您需要在調試配置中添加源代碼:
執行以下步驟:
選項1:
Right Click(Java Source) -> Debug As -> Java Applications
選項2:如果選項1無效:
Menu ->Run ->Debug Configurations..-> Java Applications -> RightClick & select New
In right side,
Enter Name
Browse your Project and the class having `main` method
In Classpath, add your project from workspace
Click Debug button in the bottom
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.