

You need to explicitly set your CLASSPATH environment variable to list all


Program uses classes that are not in the current working directory, then Need to set a CLASSPATH environment variable the Java VM looks forĬlasses in the current working directory by default. To run a simple Java application, you do not class files using the paths listed in your CLASSPATHĮnvironment variable. When the Java VM runs your program it searches for application The CLASSPATH environment variable and JAR files The Java VM to run your application's byte-code:įor example, to run the main method from the FooĪny command line arguments (arguments to Foo's Once you have successfully compiled your Java source code, you can invoke More information on makefiles is available We suggest that you get in the habit of using makefiles for compiling java file additionally can contain code for protected javaįile where the first part of the file name is identical to the class name. The results of a successful compile of Foo.java will produceĪ byte-code version of the class in a file named Foo.class.Įvery public class that you write must be in a separate. class file forĮach class defined in the Foo.java source file). If there are no errors in your source file, the Java compiler will produce The -g command line option is optional, but we recommend Version of machine code the target machine is the Java VM rather than the Java source code must be compiled into byte-code using the Java IDE (like Eclipse) then you should look at its documentationįor information on using its editing and debugging features.īefore the Java virtual machine (VM) can run a Java program, the program's

Debugging Threaded Programs NOTE: These instructions are for using Sun'sĭistribution of java (SDK) without an IDE.Compiling and Running Java Programs Compiling, Running and Debugging Java Programs
