java help videos resources

WRITING JAVA PROGRAMS | SWING | JAVA DOWNLOADS
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) and Unix Information and Editors are located on the Help Page.

  1. The easiest way is to use a programming editor to type in your Java programs on your local computer, then transfer the files to the FAS system using a secure FTP program. You can then connect through telnet, and compile and run them on FAS (Java is already installed there). All programs except Swing 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.

    DO NOT use a word processor, e.g. Word or WordPerfect! They add lots of formatting characters which you never see, but which will prevent your programs from ever compiling. On Windows, you may use Wordpad and make sure you save the files as "Text Document" with the .java extension. If the system adds 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. On the Mac, use BBEdit Lite (also in the Downloads section).

  2. You can use a telnet program to connect 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 write and compile on your own computer at home. If you wish to do this, you will need a programming editor to write the programs (see above under #1), as well as a JDK (Java Development Kit) to compile and run them. Thus, if you have a PC, you will need to download and install the SDK from Oracle. You still must upload and run your programs on FAS to submit them for homework.
 
Return to top
 
Swing Programs
Due to their graphical nature, Swing programs cannot be run through a telnet window. It is possible to obtain a similar program known as an XWindows client that handles graphics, but unless you have a high-speed connection at home, using one to connect to NICE and run programs will be impractical. There are thus four choices for writing and running Swing programs for this course; they are as follows:

(1) Compile and run your programs on the Linux Workstations at the Science Center. These computers, in the first 3 rows of Room B-14, run XWindows as part of their operating system (Linux), and can therefore run Swing programs already. This is probably the easiest solution, if you can come to campus.

(2) Download the Java SDK 1.6 from Oracle, linked below, and install it on your home computer. If you have already done this, you are all set - the JDK will do a very fine job of running Swing. This application comes pre-installed on Apple computers running OS X. If you get messages on Windows that the java and javac commands aren't recognized, see the info from Sun on how to set your PATH variable (http://java.sun.com/j2se/1.6.0/install-windows.html) - you can test the commands by typing 'java -version' at a command prompt. You should see information on your Java version.

(3) Get an X-Windows server , which allows you to connect to the FAS system from home and run Swing programs, something a regular telnet client cannot do. We will post more information here when we get to Swing.

(4) Get a Linux Live (bootable) CD and run it to connect to NICE. One of the better ones is Knoppix (http://www.knoppix.com), which does automatic hardware detection and set-up. You can purchase a Knoppix CD for a few dollars, or download the disk image and burn it to a CD yourself for free. Then set up your computer to boot from a CD, put this in your CD drive, and restart the computer. It will come up in Linux (without installing anything on your hard drive!). Once there, open a terminal window and type 'ssh -Y username@nice.harvard.edu' and it will begin an X-Windows session.
 
Return to top
 
Java Downloads
JAVA SDK'S:
These are the nuts and bolts of Java - this used to be known as the JDK (Java Development Kit); then Sun renamed it the Java SDK (Software Development Kit); now it seems to be back to JDK. The release we will use is 1.6.0. Macs have Java already included, and it will be the current version if you've done System Updates. You can check the version of a Java installation by typing the command 'java -version' at a command prompt.
 
Windows:
NOTE that you do NOT need the NetBeans package or J2EE, just the Java SE Development Kit.
JAVA SDK 1.6 (free) http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u27-download-440405.html
SDK INSTALLATION http://www.oracle.com/technetwork/java/javase/index-137561.html
 
Macintosh:
MAC OS X JAVA 1.6 Already installed on OS X