Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search a code line in Eclipse

I'm developing a code in Eclipse (java). While debugging the code, I used a lot of System.out.println(...). Now I need to delete all these lines. To do this, I wrote System.out.println in Search->Java, but it hasn't provided any search result. So, how can I find all occurancies of this string System.out.println?

like image 996
Klausos Klausos Avatar asked Jan 12 '12 21:01

Klausos Klausos


3 Answers

Search -> File. Input "System.out.println" and select the type of files you want to search in "*.java" (without quotes)

The "Java search" is something different. It doesn't allow you to find stuff in java files but methods/declarations/etc. in java files. For instance declare somewhere in your project "String canYou = "FindMe?";" and then do Search -> Java, input "String" and select "Type" and hit search. It should find all the String uses in you project, including the aforementioned one.

like image 168
Mateusz Dymczyk Avatar answered Nov 10 '22 10:11

Mateusz Dymczyk


Try writing System.out.println anywhere in your project, select this text and afterwards press ctrl + alt + g (sorry don't know exactly what kind of search this stands for) and it will give you all the occurrences of this string in all your projects(workspace-wise). I'm 100% sure it stands for exactly something in search > java - you can take a closer look to see for exactly what. Other than that you can have a conditional execution for the logs - i.e

if(Consts.DEBUG){
    Log("something");
}
like image 38
asenovm Avatar answered Nov 10 '22 11:11

asenovm


press Control + H

this will open up the search window, go to File Search tab and look for the system.out.println(

like image 2
Karis Avatar answered Nov 10 '22 11:11

Karis