[FIXED] Remove All Comments in Java Files


I have many comments like following. Is there simple way to remove all comments?

IDE Eclipse Kepler

/* 34:   */


 * JD-Core Version:



I have found the solution Regular Expression with multiple lines search.

Here are the regular expression used to find two types of comments

\/\*([\S\s]+?)\*\/ and (?s)/\*.*?\*/

Open the .java file with comments and open the Search dialog.(Search -> File Search) and paste one of the above reg-ex and check the Regular expression tick box on the right side. Now you can search and select “Replace All” to replace it with nothing typed in the second box.

Using replace-with option I have cleaned all comments from java files.

Answered By – Ahmet Karakaya

Answer Checked By – Marilyn (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published