CS3134: William’s Recitation 2 (thanks to Andrew Howard for Andy’s Recitation 1)
Useful Programs to Have and Useful Websites
Many of these resources can be found on the resources pages but I will
include them here since they are covered in recitation.
Quick Guide to cunix
ACIS provides info on various basic unix commands plus much more.
AcIS Internet Software ACIS provides links to
many useful internet tools for various platforms.
SSH This is a free SSH client and Secure
File Transfer Client for Windows. Download: SSHSecureShellClient-3.2.5.exe
(or you can use TeraTerm
or PuTTy)
X-Win32
This will allow you to export you display from Newcunix
so you can remotely use graphical linux tools. (If you are on a
Mac, check apple.com for X11; the comparable download)
Javadoc
documentation for JDK 1.4.2. This is the most useful tool that you
could ever use. Includes detailed explanations of all of Java’s core
classes.
J2SE 1.4.2 SDK Java Software Development Kit download- you'll need this if you want to develop
your code on your local machine before testing on cunix. (If you are on a Mac, check apple.com for the download)
You have a few options for your development environment. These vary from the easiest setup to more complicated setups. The tradeoffs? Some would
argue that what you lose in ease of setup, you more than gain in ease of development. It is entirely up to you and your comfort level.
All deveopment in a terminal on cunix...
1.Log on newcunix.cc.columbia.edu
using SSH, TeraTerm, or, PuTTy. (On a mac, use ssh from the terminal)
2.Type “Emacs filename.java” where filename is the name of the file
you will be editing. Text-based Emacs will load within your terminal, ready to edit your files. (alternatively,
you can use any plain text editor like vim, etc.)
3.To compile your program, back on the command line,
type “javacfilename.java”
where filename is the name of the file
4.To run, type “java filename”,
note you do not use the .java or .class extension
5.When you are finished with your
project submit by typing “~cs3134/bin/submit”. This will submit everything in your directory and send you an
email confirmation.
Or, export your display and use GUI emacs from cunix...
2.Log on newcunix.cc.columbia.edu
using SSH, TeraTerm, or, PuTTy. Be sure to turn on IP X forwarding before you log in as
outlined in the X-Win32 setup. (on a mac, use ssh -X)
3.Type “Emacs filename.java” where filename is the name of the file
you will be editing. An emacs window should pop up on
your desktop ready for use. If this doesn’t happen, there is a mistake in
step 1 or most likely 2.
4.In Emacs, under “Options”,
choose “Syntax Highlighting”. This will allow for useful coloring.
5.To compile your program, back on the command line,
type “javacfilename.java”
where filename is the name of the file
6.To run, type “java filename”,
note you do not use the .java or .class extension
7.When you are finished with your
project submit by typing “~cs3134/bin/submit”. This will submit everything in your directory and send you an
email confirmation.
Or, develop locally and move files to cunix for submit...
1.Make sure you have the J2SE 1.4.2 SDK installed.
(typing “javac” at a command prompt should give you the help file if everything is ok.)
2.Using a text editor (wordpad, notepad, etc. NOT MSWORD!) or an IDE (you could use NetBeans, or Eclipse) write your program and save it
somewhere on your local harddrive.
3.To compile your program, back on the command line,
type “javacfilename.java”
where filename is the name of the file
4.To run, type “java filename”,
note you do not use the .java or .class extension
5.When you are satisified that your code is correct, FTP it to your cunix account
using a file transfer protocol (FTP) program. ACIS has software here.
6.Test your code on cunix before you submit! It must work on cunix.
We will only grade files that compile (and run) on cunix.
7.When you are finished with your
project submit by typing “~cs3134/bin/submit”. This will submit everything in your directory and send you an
email confirmation.
Example Code
Hello.java This is basic
Hello World code. It demonstrates the minimum needed to run some Java
code.
PrintNumbers.java
This code takes a series of numbers as command in arguments and then
prints them out. It demonstrates command line input, converting strings to
integers and back again, string concatenation, and the .length method for
arrays. Example run: “java Print Numbers 3 4 5”
SaveKeyboard.java
This code takes input from the keyboard and saves it to a file. It demonstrates
reading from the command line, writing to files, try, catch, finally, and
exceptions. Try entering comma separated data for use with ParseFile.java
ParseFile.java
This code reads from a file splits it up and prints it out. It
demonstrates reading from files, and stringtokenizer