Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple List of All Java Standard Classes and Methods?

I'm building a very simple Java parser, to look for some specific usage models. This is in no way lex/yacc or any other form of interpreter/compiler for puposes of running the code.

When I encounter a word or a set of two words separated by a dot ("word.word"), I would like to know if that's a standard Java class (and method), e.g. "Integer", or some user defined name. I'm not interested in whether the proper classes were included/imported in the code (i.e. if the code compiles well), and the extreme cases of user defined classes that override the names of standard Java classes also does not interest me. In other words: I'm okay with false negative, I'm only interesting in being "mostly" right.

If there a place wher I could find a simple list of all the names of all Java standard classes and methods, in the form easily saved into a text file or database? (J2SE is okay, but J2EE is better). I'm familiar with http://java.sun.com/j2se/ etc, but it seems I need a terrible amount of manual work to extract all the names from there. Also, the most recent JDK is not neccesary, I can live with 1.4 or 1.5.

Clarification: I'm not working in Java but in Python, so I can't use Java-specific commands in my parsing mechanism.

Thanks

like image 517
Roee Adler Avatar asked May 16 '09 05:05

Roee Adler


People also ask

How many Java classes are there?

Classes live in packages . There are 5,000 or so classes built-in to Java, and programmers have written hundreds of thousands if not millions of their own.

What are Java classes and methods?

Java is object-oriented programming language. Java classes consist of variables and methods (also known as instance members). Java variables are two types either primitive types or reference types. First, let us discuss how to declare a class, variables and methods then we will discuss access modifiers.

What are standard methods in Java?

In Java, predefined methods are the method that is already defined in the Java class libraries is known as predefined methods. It is also known as the standard library method or built-in method. We can directly use these methods just by calling them in the program at any point.

What is standard classes in Java?

Java's standard classes are analogous to off-the-shelf hardware components. Java includes a multitude of classes. These classes are organized into collections called packages. In order to speed compilation and class loading during execution, the compiler normally has access to a small subset of the standard classes.


2 Answers

What's wrong with the javadoc? The index lists all classes, methods, and static variables. You can probably grep for parenthesis.

like image 181
Eugene Yokota Avatar answered Oct 03 '22 04:10

Eugene Yokota


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

This will be 10's of thousands classes and method which can be overwhelming.

I suggest instead you use auto-complete in your IDE. This will show you all the matching classes/methods appropriate based on context. e.g. say you have a variable

long time = System.

This will show you all the methods in System which return a long value, such as

long time = System.nanoTime();

Even if you know a lot of the method/classes, this can save you a lot of typing.

like image 43
Peter Lawrey Avatar answered Oct 03 '22 04:10

Peter Lawrey