Reputation: 16060
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
?
Upvotes: 6
Views: 11477
Reputation: 31
We have written an eclipse plugin to do the same. It will find the System.out.println in your java code and comment it out. We will soon have a version which will delete it also. Hope this is useful.
http://eclipseo.blogspot.in/2013/05/commenting-systemoutprintln-from.html
Upvotes: 0
Reputation: 2120
Use the menu Search->File and in the "Containing Text" field type in "System.out.println*", in the "File name patterns" field type in "*.java". Now press the "Replace" button in the lower right corner. Leave blank the "With" field and click the "Preview" button. Uncheck any occurrences you want to keep and then press "OK".
You may want to make sure your code is in version control before attempting this in case you do it wrong and want to go back.
Upvotes: 0
Reputation: 15141
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.
Upvotes: 10
Reputation: 512
press Control + H
this will open up the search window, go to File Search tab and look for the system.out.println(
Upvotes: 2
Reputation: 6517
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");
}
Upvotes: 2
Reputation: 120308
just search for println
. I bet eclipse is interpreting what you are putting in as a regex.
Upvotes: 0