Edit-Compile-Test on Unix in T-411


Summary

 

 


Login to the Unix server

 

 


Make a new subdirectory (folder)

 

  • Step 1: Use the mkdir command to create a folder called testfolder2:

  • Step 2: Enter the folder using the cd command:

  • Step 3: See what's in the folder using the ls command
           => You should see no output.
 


Edit using Pico

 

  • Step 1: Fire up pico at the command-line with the desired filename HelloWorld.java:

  • Step 2: Now type in (or edit) the text for the program:

  • Step 3: Use ctrl-X to save the file and come out of the pico editor:
    • ctrl-X will prompt you. Type y (for yes).
    • Then the filename appears. Hit Enter (return).

      Important: the filename is case-sensitive.

 


Compile at the command-line

 

  • Step 1: When you are out of the editor, you'll still be in the same directory. Type javac followed by the filename:

    You will note that nothing appears to happen
            => Later, we will learn that this is a good thing (no errors reported)

  • Step 2: Check and see that there are two files now in the directory, the .java file and the .class file:

 


Execute the program at the command-line

 

  • Execute the program by typing java HelloWorld at the command-line: