user133466
user133466

Reputation: 3415

Eclipse debugger is blank (source not found)

im trying to debug the following code, and i have breaked at line w= w+ inputString.substring(firsti,i)+"yay"; but debugger shows blank (source not found) what's going on?

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;
}

Upvotes: 0

Views: 655

Answers (2)

kosa
kosa

Reputation: 66637

You might be trying to get into substring() method which is inside java API. You need to attach Java source to debug substring()

How to attach source:

Go to Project > Properties > Java Build Path > Libraries and expand JRE System Library JRE Version then, rt.jar. Select Source attachment, click Edit…. Select the source code file (External File…) and press OK

Read this link for more info.

Upvotes: 1

Yogendra Singh
Yogendra Singh

Reputation: 34367

You need to add your source code in the debug configuration:

Perform the Steps below:

Option1:

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

Option2: If option1 doesn't help:

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

Upvotes: 0

Related Questions