Hi,all
I need a java parser for parsing any java file in any package,not only existing file ...Can i do this ? how?

Re: A java parser for parsing any java file in any package 80 80

Mar Na, you have 6 posts now that dance around but never really come out and tell what you are trying to accomplish.

In a few I see ready to use tools that have source so I would be left guessing what your big picture is here.

Do yourself a solid and reveal your big picture.

Re: A java parser for parsing any java file in any package 80 80
package javaapplication12;
public class  CyclomaticComplexity {
public static void main(String[]argv) throws ClassFormatException, IOException {

ClassParser parser=new ClassParser(CyclomaticComplexity.class.getResourceAsStream("/javaapplication12/CyclomaticComplexity.class"),"CyclomaticComplexity.class");
    JavaClass javaClass=parser.parse();
    }}}
Re: A java parser for parsing any java file in any package 80 80

Mr. rproffitt ,in this my code,java parser ,parsing only existing class in existing package,i want to modifiy class path and writing other class path from other package but isn't work!?

Re: A java parser for parsing any java file in any package 80 80

@M

I was hoping to read more about your big project and what it does, goals and more. Are you cross posting?
https://www.google.com/search?q=parsing+any+java+file+in+any+package seems to say you are.

Re: A java parser for parsing any java file in any package 80 80

Ok, thank you very much to help me.

Re: A java parser for parsing any java file in any package 80 80

Look at the constructors for ClassParser. You are using the one that takes an input stream, which you get from you current class loader. It would be a lot easier to use the constructor that takes a file name, or if your class is in a jar, the one that takes a zip file and a file name.

Re: A java parser for parsing any java file in any package 80 80

How can i use it ? is there any example or website that clarify this?

Re: A java parser for parsing any java file in any package 80 80

It's a simple constructor. If you don't know how to use it then, to be honest, you are not yet ready to start using tools like this.

Re: A java parser for parsing any java file in any package 80 80

Ok , I know how to use it but , when I write path I get error ...

Re: A java parser for parsing any java file in any package 80 80

If you tell us what the error is then maybe we can help. Post the exact code and the complete error message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.