1

I'm looking for a very simple way, from Python, to get information about Java classes:

  • name of the class
  • what it extends and implements
  • methods with returns types and parameters
  • attributes with type information

Basically all of the information you'd need to generate a javadoc.

Is there an existing Python library that can get me this information either for a .java or .class file, doesn't matter. I'd probably even be okay with something that gets this information from a javadoc.

I know there is javaclass library but that is overkill for what I'm looking for.

Just want to make sure something doesn't already exist like this before I implement my own.

7
  • 2
    "Just want to make sure something doesn't already exist like this before I implement my own." Wouldn't googling solve that problem more reliably? Commented Sep 3, 2011 at 14:12
  • What I'm looking for could easily not be a project on its own but a one-off script someone has written. Also, google is not perfect, there are plenty of tiny libraries out there that are almost impossible to find by googling. Commented Sep 3, 2011 at 14:27
  • Can you run your python code in jython? Commented Sep 3, 2011 at 14:32
  • @lex: Maybe I am misunderstanding the question. How do you expect to find to these small scripts (in order to analyze them), if not via some search tool? Commented Sep 3, 2011 at 14:34
  • @Mark yes, but that is the last resort, I don't want to be dependent on Jython. again, it seems overkill for just getting basic info. Commented Sep 3, 2011 at 14:45

1 Answer 1

1

If your Python code does not make much use of C based libraries you could run the code in Jython which is Python run on the Java VM.

Otherwise you could write a small Java/jython executable that gets the information and writes it to stdout to be read by a CPython program calling it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.