A simple list of all the standard Java classes and methods?

I am creating a very simple Java parser to find some specific usage patterns. This is in no way lex / yacc, or any other form of interpreter / compiler for navels executed by code.

When I come across a word or a set of two words separated by a period ("word.word"), I would like to know if this is a standard Java class (and method), for example. An integer or a specific username. I am not interested in whether the proper classes were included / imported into the code (i.e. if the code compiles well), and the extreme cases of custom classes that override the names of the standard Java classes also do not interest me. In other words: I'm fine with a false negation, I’m only interested in being β€œmostly”.

If I could find a simple list of all the names of all the standard Java classes and methods, in a form easily saved to a text file or database? (J2SE is fine, but J2EE is better). I am familiar with http://java.sun.com/j2se/ etc., but it seems to me that I need a lot of manual work to extract all the names from there. Also, the last JDK is not needed, I can live with 1.4 or 1.5.

Clarification: I do not work in Java, but in Python, so I cannot use Java-specific commands in my syntax.

thanks

+6
java python parsing
source share
6 answers

What happened to javadoc ? Index lists all classes, methods, and static variables. You can probably grep for parentheses.

+1
source share

To get all classes and methods, you can look at the index at http://java.sun.com/javase/6/docs/api/index-files/index-1.html

It will be 10 thousand classes and a method that can be overwhelming.

I suggest using autocomplete in your IDE instead. This will show you all suitable classes / methods appropriate based on context. for example let's say you have a variable

long time = System.

This will show you all the methods on the system that return a long value, for example

long time = System.nanoTime ();

Even if you know many methods / classes, this can save you a lot of information.

+1
source share

If you just want to create a list of all classes in Java and their methods (so that you can populate a database or XML file), you might want to write an Eclipse plugin that scans the entire JavaCore model and scans all its classes (for example, by searching for all subtypes of the object). Then list all the methods. You can do this technically in any library by including it in your context.

+1
source share

IBM had a tool for creating XML from JavaDocs, if I'm not mistaken: http://www.ibm.com/developerworks/xml/library/x-tipjdoc/index.html

+1
source share

It is also possible to either parse the classlist file from the jre / lib folder, or open the jsse.jar file, list all the classes and make a list of them in a dot-separated form.

+1
source share

When I come across a word or a set of two words separated by a period ("word.word"), I would like to know if this is a standard Java class (and method), for example. An integer or a specific username.

If this is what you need, you can do without a (limited) list of Java classes using some simple reflection: http://java.sun.com/developer/technicalArticles/ALT/Reflection/

 try { Class.forName("word.word"); System.out.println("This is a valid class!"); } catch (ClassNotFoundException e) { System.out.println("This is not a valid class."); } 

Something like this should be enough for your purposes, as he added an advantage not limited to a subset of classes and extensible by any libraries on the way to classes.

0
source share

All Articles