javac MyClass.javaOr, if you need to specify a classpath other than the default:
javac -classpath mypath MyClass.javaThis should produce a class file MyClass.class. The javac compiler will try to (recursively) locate and compile any classes used by the compiled class. However, don't depend on it to recognize that the source (.java) and object (.class) files are out of sync for any class. Either remove all .class files before compiling, or use
make.
You will save yourself a lot of frustration.
Note: The javac compiler is pretty insistant that the file MyClass.java contain
the class MyClass.
main() for your function. No extension is required on
the class name.
java MyClass
time command.
time java MyClassThis will display user, system, and total elapsed time used by the process (in a more or less unreadable format).
javac -classpath "foo:.:/user/me/classes/:libdir/goodstuff.jar" MyClassNote that .jar files, being archives, look like paths to javac.
Java 1.2 Doc Homepage: A list of links to Java documentation.
Java 1.3 Doc Homepage: A list of links to Java documentation.
Javadoc Homepage: A list of links to documentation on Javadoc.
java.sun.com: Java home page at Sun. You can find lots of stuff from here (eg servlet API documentation), but it's harder than you'd think.
Google: An excellent resource. If you are stuck, type in your question (or it's keywords) and go. I find it the best question answering system and best overall resource on the Web. To find information on some programming structure, problem or utility, try searching on "mytopic tutorial" or "mytopic reference". Ex. Searching on "java threads tutorial" will find a lot useful information on how to use threads in Java.
Some documentation on GNU make: Tedious, but useful.
Bruce Eckel's MindView inc page Bruve Eckel is the author of Thinking in Java, Thinking in Patterns, and several other books. The Thinking in Java book is a good complement to the Core Java book used in class. TIJ2 is available from free in HTML or PDF from this site (which is a good reason in itself to go buy it). [Note: I consider TIJ2 and Core Java to be the two best Java book out there. I think the Core Java is a better reference and overview (which is why I chose it for the course), while the TIJ is probably a better beginning tutorial and OOP manifesto.]