New to Java? We'll help you get started with our revised beginner's tutorial, or our free online textbook.


Get the latest Java books
h t t p : / /w w w . j a v a c o f f e e b r e a k . c o m /

Java Coffee Break

Menu



Learning Java

Articles
Author Profiles
Lessons
FAQ's
Books
Newsletter
Tutorials
Talk Java!

Using Java

Applets
JavaBeans
Servlets
Resources
Discuss Java


Looking for Java resources? Check out the Java Coffee Break directory!

Getting started with Java

"A beginner's guide to Java programming"


Compiling your first Java application

While some languages are interpreted (such as PERL), others introduce an extra step, called compilation. Compilation takes source code (files ending in a .java extension), and converts it into byte-code. This byte-code is low level machine code, which is executed inside a Java Virtual Machine (JVM).

To compile Java code, we need to use the 'javac' tool. This ships as part of the JDK, so if you have it installed and in the current path, you can compile your application using the following command from any DOS prompt or Unix session :

javac myfirstjavaprog.java

This will produce a Java class file, called myfirstjavaprog.class. Once your program is in this form, its ready to run. Check to see that a class file has been created. If not, or you receive an error message, check for typographical errors in your source code.

Next : Running your first Java application

Back to main


Copyright 1998, 1999, 2000 David Reilly

Privacy | Legal | Linking | Advertise!

Last updated: Monday, June 05, 2006