in my program I dynamically get the name of the .java file. In this file I need to find all methods, foreach method also all parameters (also with their annotations).
I read through the discussions here and found this https://code.google.com/p/javaparser/ javaparser, that seems pretty easy to use, but the problem is, that it is just for 1.5.
Than you mentioned, that Java 1.6 has already got built-in parser (javax.lang.model). But I can not figure out, how it works. Do you know any good tutorial/example of it?
Do you know any other way to parse java source file?
How about using Doclet API?
Normally, This API is used from bat file, but you can invoke programmatically like the following.
IMPORTANT: This API exists in not rt.jar(JRE) but tools.jar (JDK). So you need to add tool.jar into classpath.
Take another look at the javaparser project. It has been updated to support all modern Java versions.
The Doclet API is really hard to use and is badly documented. It will be either going away or be replaced with something better, hopefully even in Java 1.9.