Developing Java at the Command Line

Some people prefer not to use an Integrated Development Environment (IDE). As long as you have the Java Software Development Kit downloaded (SDK), you can compile, run, and debug your programs from the command line.


Windows

If you're doing this on your dorm computer, you'll want to add the Java SDK to your path (in the labs this has already been done for you). Be very careful when modifying your path (you don't want to screw up your system :-):

Now open a command window by entering windows+r (hold down the curvy window key and the r key simultaneously) and type cmd. From this window, type

   javac -version
At this point, you should see something about version 1.5..., which means your path has been properly changed.

To compile your application, cd to your homework/problem source_code directory. From there type:

    javac *.java
This will compile your program. If there are errors, these will be displayed in the command window. Because you're not in an IDE, at this point you'll have to use your favorite editor to fix these errors. (That editor should display line numbers so you can easily find the errors; alot of people seem to like JEdit, which can be obtained here.)

Once your program compiles, you're ready to run it. In the command window type:

    java CS5App

Note: if you're also interested in debugging your program using Java's debugger, you can also do this from the command line. Click here for more information on that.

That's about it!


Mac

This section hopefully coming soon (if you want to bring your Apple to my office during office hours, I'd be happy to help you in person).