ࡱ> ^`]#` -bjbj .P-nnnnnnnJ"J"J"J"4~"326#6#6#6#6#6#6#6#2222222$84h62n6#6#6#6#6#2nn6#6#2d&d&d&6#n6#n6#2d&6#2d&d&V.@nn]/6#*# XhJ"$. 0203.x^7%^7]/]/T^7n/6#6#d&6#6#6#6#6#22N&6#6#6#36#6#6#6#&$ &nnnnnn COMS S1004 Getting started with Java on CUNIX Before you start If you do not have a CUIT password, go to http://uni.columbia.edu/ and then click Activate a NEW UNI Account. Once you have a UNI/password, you can modify your account by clicking Login to Manage Your UNI Account. If you are using your own PC (Windows-based), then you should download PuTTY at http://www.columbia.edu/acis/software/putty. You will need your UNI/password in order to download it. If you are on a Mac, you can use Applications:Utilities:Terminal (you dont need to download anything). On Linux, open a new terminal window. 1. Log into CUNIX If youre using PuTTY, just choose the Cunix shortcut. If you dont have it, start PuTTY and set the Host Name to cunix.cc.columbia.edu. Make sure the Protocol is SSH. If youre using Mac Terminal or a Linux window, connect with the following command: ssh uni@cunix.cc.columbia.edu where uni is your Columbia UNI. Hint: you may want to open two windows: one for writing the code, one for testing it. 2. Create a new directory For each homework assignment, you should create a new directory (folder) in your account. Execute the following command to create a directory called test: mkdir test 3. Change to that directory Now you can navigate into that directory with the following command: cd test See below for other commands for navigating directories. 4. Edit and save the Java source file You will edit the file using a plain-text editor. Note that you cannot copy and paste text like you are probably used to; the terminal window will not see the mouse. There are two programs you can use: emacs or pico. To start the program and create the file, use the following command: emacs nw HelloWorld.java or pico HelloWorld.java See below for instructions on how to use these programs. Here is a very simple Java program (note that line numbers are not part of the program!): 1 2 3 4 5 6 7 8 9 10 11 12 13/* * This class just prints Hello, World. And thats it. */ public class HelloWorld { /* This is the main method. The program starts here. */ public static void main(String[] args) { // this is how to print something out System.out.println(Hello, World!); } } When you are done typing, save and exit the editor using the commands on the next page. 5. Compile the code Once you have saved the file and exited the editor, you can try to compile the code with the following command: javac HelloWorld.java If you dont get any messages, that means the code compiled properly! If you see error messages, go back to Step 4 and fix them. 6. Execute the code Once the code has properly compiled, you can execute it (run the program) as follows: java HelloWorld 7. Logout To terminate your session, log out like this: logout Thats it, youre done! Other useful UNIX commands Delete a filerm filenameRename/move a filemv old_name new_nameCopy a filecp filename new_nameView a filemore filenameList the contents of a directoryls lReturn to the home directorycdGo up to the parent directorycd .. You can find more at http://www.columbia.edu/~lgw23/cs1004/ and http://www1.cs.columbia.edu/~cmurphy/1004/intro_to_CUNIX.pdf Editing with emacs Save a fileCtrl-X Ctrl-SOpen a fileCtrl-X Ctrl-FCut a lineCtrl-KPaste a lineCtrl-YExitCtrl-X Ctrl-C Other emacs commands are listed at http://www.columbia.edu/acis/publications/emacs.html Editing with pico Save a fileCtrl-OCut a lineCtrl-KPaste a lineCtrl-UExitCtrl-X Other pico commands are listed at http://www.columbia.edu/acis/publications/pico.html   ./?@j    l  ` a b f t u   |     ) * սγկٯٯَٜzh3uh3u5 hD.phD.p hD.p6hD.p h6 h5 h3u5 hWh hhhh)X hW0JhWhW0JhWhW\ hWhWhWh_U h)X5 h n5h nh_U5CJ$aJ$h nh n5CJ$aJ$. ./@  a b c u  t    * h^hgd_Ugd3ugdgd_U$a$gd n-* 6 7 : > ? @ x y z { ~ 0o¾籧֖Ҏyoyhhyhdh h=h_Uhz.OJQJ^Jh=h_UOJQJ^Jh=h_U5h=h=5h4ThBeh4TOJQJ^Jh_UOJQJ^JhBehBeOJQJ^JhBehBeh_U5hBehBe5h=h_UhBehLOJQJ^JhBeh_UOJQJ^Jh3uhY}hL% 7 ? @ y z { /0 $Ifgd_Uh^hgd_Ugd=h`hgd_Ugd_Uor+58I  $%23ÿvqlel h4Th4T h4T5 hKf5hhyOJQJ^JhyOJQJ^Jhyhhy5 hy5hh_UOJQJ^Jhhh_U5hh5h_U hz.hz.hz. h_U5hUCJOJQJ^JaJh_UCJOJQJ^JaJ h=h_Uh= h=6%=eh $Ifgd_U+345I||sn|s||||ngdh^hgd_Ugd_U}kd$$Ifl0h#t" t0H$644 layt_U I %3? $Ifgd_U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If!vh5L5L#vL:Vl t65Lyt4TP$$If!vh5L5L#vL:Vl t65Lyt4TP$$If!vh5L5L#vL:Vl t65Lyt4TP$$If!vh5L5L#vL:Vl t65Lyt4TP$$If!vh5L5L#vL:Vl t65Lyt4TP$$If!vh5L5L#vL:Vl t65Lyt4TP$$If!vh5L5L#vL:Vl t65Lyt4TU$$If!vh5L5L#vL:Vl t65Lyt4TU$$If!vh5L5L#vL:Vl t65Lyt4TU$$If!vh5L5L#vL:Vl t65Lyt4TU$$If!vh5L5L#vL:Vl t65Lyt4T@@@ NormalCJ_HaJmH sH tH DA@D Default Paragraph FontRi@R  Table Normal4 l4a (k(No List6U@6 E Hyperlink >*B*phj@j oy Table Grid7:V0$O$ Wheader-P ./@abcu t*7?@yz{/0=eh  + 3 4 5 I % 3 ? @ S h i u    V      t u v w *+,/0000000000000000000000000000000000000000000000000000000 0000000000000 0 0000000000000000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00@000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000000 0 0 0 0 0 0 0 0 0 0 0 000000.@abu=eh % 3 ? @ S h i u V     t v w *+/0000/00.001000@000000000000000000 0 00000A,:0@0000;:00:00800090000+00 00 00+ 00 00 00+ 00 00 00+ 00 00 00+ 0"0 0"0 00+ 0 0000'00'00000 00 00+ 00 00 00+ 00 00 00+ 00 00 00+ 0"0 0"0 00+ 000:0;>000;000 00 00+ 00 00 00+ 00 00 00+ 0"0 0"0 00+ 000000* o3+- ' I?h-  !"#$%&-chx{79mrvz_c 3 5 S U V ^ _ g  " ' /x{79  /333333333333/? + % S i   w //VvE Xa2AH|I@%A\^`o(. ^`hH. pLp^p`LhH. @ @ ^@ `hH. ^`hH. L^`LhH. ^`hH. ^`hH. PLP^P`LhH.h^`OJQJo(hHh^`OJQJ^Jo(hHohpp^p`OJQJo(hHh@ @ ^@ `OJQJo(hHh^`OJQJ^Jo(hHoh^`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohPP^P`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohpp^p`OJQJo(hHh@ @ ^@ `OJQJo(hHh^`OJQJ^Jo(hHoh^`OJQJo(hHh^`OJQJo(hHh^`OJQJ^Jo(hHohPP^P`OJQJo(hHXaV|I@%                           9@K9@V"YeZV"Y =eF\~ )XE:cBe_LBFN!U0g4>;E4TUWX%_4`w`Ym nD.p3ucvY},}}#UW7D=01Kfbp6Jj I|Yy_U)EriQ33oyz.|L5% 3 ? @ S h i u       /@ 4/N-P@UnknownGz Times New Roman5Symbol3& z Arial?5 z Courier New;Wingdings"1h2µ:  !4d&& 2QHP?E2COMPUTER PROGRAMMING IN JAVAProgramming Systems LabProgramming Systems Lab   Oh+'0 $0 P \ ht| COMPUTER PROGRAMMING IN JAVAProgramming Systems Lab Normal.dotProgramming Systems Lab58Microsoft Office Word@":@lvT@ ՜.+,0 hp  Columbia University& COMPUTER PROGRAMMING IN JAVA Title  !"#$%&'(*+,-./023456789:;<=>?@ABCDEFGHIJKLNOPQRSTVWXYZ[\_Root Entry F?taData )1Table1v7WordDocument.PSummaryInformation(MDocumentSummaryInformation8UCompObjq  FMicrosoft Office Word Document MSWordDocWord.Document.89q