logo

Java

graphic
Home Page Java FAQ's Videos Resources
WRITING JAVA PROGRAMS | DOWNLOADS
JAVA LINKS
Here are some links which you may find useful.

The Java Tutorial:
Basic Concepts
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html
The Java Tutorial: Objects http://java.sun.com/docs/books/tutorial/java/data/objects.html
Error Messages http://java.sun.com/docs/books/tutorial/getStarted/problems/index.html
 
WRITING JAVA PROGRAMS

Since Java files are really text files which are compiled into bytecode and run by the Java Virtual Machine (JVM), there are several options for writing your programs this semester. Remember that links to other Useful Downloads (e.g., programming editors, Telnet clients) and Unix Information and Editors are located on the Resources page.

  1. The easiest way is to use a basic text editor to write your Java programs, then transfer files to the FAS system using an FTP program, connect through telnet, and compile and run them on FAS (fas.harvard.edu - Java is already installed there). They MUST be on FAS in order to submit them for your homework. To use this method, you may want to learn enough about one of the Unix text editors to be able to make any needed quick corrections to your files, or plan to update the file locally and re-transfer it. More information about transferring files is on the FAQ page.

    DO NOT use a word processor, e.g. Word or WordPerfect! They add lots of formatting characters which you don't see, but which will prevent your programs from ever compiling. On Windows, you may use Notepad or Wordpad and make sure you save the files as "Text Document" with the .java extension. If the system tries to add a ".txt" suffix, put quotes around your file name and extension in the Save box to prevent this. You may also try any of the editors in the Useful Downloads section (one we highly recommend for PC's is Programmers File Editor). On the Mac, use BBEdit Lite (also linked on the Resources page), or one of the built-in Unix editors which are available in a Terminal window.
     
  2. You can obtain a secure telnet program or use one that you have, telnet into the FAS system, and write and edit your programs on the system. There are three Unix editors which you may try: pico, emacs, and vi. Once you've written your program and saved it, then, as above, you can compile and run it on FAS.
     
  3. You can choose to work on your own computer at home. If you wish to do this, you will need a text editor to write the programs (see info above under #1), as well as a JVM (Java Virtual Machine) to compile and run them. Thus, you will need to download and install the SDK from Sun, linked below. You still must upload and run your programs on FAS to submit them for homework.
     
    Once you've typed in and saved your program, you will need to compile and run it in a command line window. You can get one on a PC by clicking START, then Run, and in the box typing 'command' (no quotes). If you are using PFE, there is a button along the top row with a DOS prompt displayed which will open a command window for you. On a Mac, use the Terminal program (located in the Utilities folder under Applications). In the command window, navigate to the directory in which your files are stored, and you should be able to compile and run them there. Here is some basic DOS info (http://www.jegsworks.com/Lessons/reference/doscommands.htm).
     
  4. You can work on your home computer, but purchase a Java IDE (Integrated Development Environment), such as Borland's JBuilder, IBM's Visual Age for Java, MetroWerks' CodeWarrior, or even Sun's Forte. One advantage of IDE's is that they'll contain a text editor, a compiler, the Java class libraries, and a debugger, all combined into one package. HOWEVER, we do not encourage this option unless you have special circumstances, and we do look to see that YOU are writing all your own code and not letting an IDE do it for you - doing so can cost you points!!
     
    NOTE: Since we have provided you with Harvard accounts to use for programming, the course staff will NOT be able to provide tech support for the various IDE's.
RETURN TO TOP
 
DOWNLOADS
JAVA Development Kits:
In order to run Java programs on your own computer (PC), you will need to download and install a Java Software Development Kit (NOT just the Java Runtime Environment, or JRE, which your computer may already have). This contains all the Java built-in libraries that your programs will need to access.

The JDK is the nuts and bolts of Java; you may also see it referred to as the SDK (Software Development Kit) or J2SE (Java 2 Standard Edition). The JRE (Java Runtime Environment) allows Java classes to run, but does NOT allow programming and compiling. The newest JDK version is 1.5, and you will need this version for the course. The links below will allow you to download and install the free SDK.

If you have Mac OS X, Java is pre-installed on your computer. You may check the version by opening a Terminal window (found in Applications / Utilities), typing "java -version", and then hitting Return. If you do not have Java 5.0, you will need to upgrade to both Tiger (OS X 10.4) and then install Java 5.0 (follow the links to Java downloads and J2SE 5.0).

Linux/Unix
users may also already have the SDK installed; if not, use the non-Macintosh link.

Windows users may follow the links below to download and install the software.
NON-MACINTOSH:
SUN'S JDK 5.0 (free)
http://java.sun.com/j2se/1.5.0/download.jsp
     Select JDK 5.0 Update 12 - you do NOT need NetBeans or J2EE!!
SDK INSTALLATION http://java.sun.com/j2se/1.5.0/install.html
   
MACINTOSH:
MAC OS X http://developer.apple.com/java/
MAC OS X & JAVA: FAQ'S http://developer.apple.com/java/faq/
RETURN TO TOP

© 2009, The President and Fellows of Harvard College
Please send comments to The Webmaster
URL: http://www.fas.harvard.edu/~libe50a/java.html
Last modified: Tuesday, 21-Jul-2009 10:02:19 EDT