Eclipse调试器是空白的(找不到来源)



im试图调试以下代码,我已经在 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()

如何附加来源:

转到Project>属性> Java构建路径>库,然后扩展JRE System Library jre版本,RT.JAR。选择源附件,单击编辑…。选择源代码文件(外部文件…),然后按OK

阅读此链接以获取更多信息。

您需要在调试配置中添加源代码:

执行以下步骤:

选项1:

Right Click(Java Source) -> Debug As -> Java Applications

option2:如果Option1无帮助:

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

最新更新