aspose file tools*
The moose likes Java in General and the fly likes Traverse and edit Java Files automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Traverse and edit Java Files automatically" Watch "Traverse and edit Java Files automatically" New topic

Traverse and edit Java Files automatically

yusuf Kaplan
Ranch Hand

Joined: Mar 11, 2011
Posts: 58
Hi all,

I need an API for traversing and editing Java files.
For example, I want to programmatically walk through a bunch of Java files in a directory and If I find a specific attribute or method within a Java file, then I want to remove or edit this attribute or method. I dont want to do it with BufferedReader and -Writer. Is there maybe any known libraries to help here?

Stephan van Hulst

Joined: Sep 20, 2010
Posts: 3394
Why do you want to edit Java files like that?
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2247

It is pretty likely that such thing would just cause compile-time errors, since supposedly the files would still be compiled after that...

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
I agree. Here's the link:
subject: Traverse and edit Java Files automatically
Similar Threads
how can i edit ejb-jar.xml in weblogic7.0..???
How to edit class files with JDK?
Ant does not output property file in classes folder.
How to compile only specific .java files, not the whole src
how to edit GUI file