parse .java file outside plugin


Hello! I wanted to use java-parser from jetBrains library. I have a simple task, I want to parse my .java class from disk and get AST, and then I want to make analysis by AST (i.e get names of anonymous classes, like Main$2$1). But as I understood all classes which do this job require some classes which environment gives me if I write a plugin. I have nothing to do with plugins, I just want to write main() method and parse .java class. 
For example PsiJavaFileImpl requires FileViewProvider, and ClassFileViewProvider requires PsiManager, VirtualFile and all this staff. 
My question: how can I do it without all these classes? I just need an instance of parser without any plugin staff. 
I saw a ticket that you published PSI library (, and I need to use it, but it didn't really help me to understand how to do it. 

Please sign in to leave a comment.