Compiling Practice

This assignment is designed to give you practice compiling and running a Java program. Start by saving the following file to your code folder.

(You can save the file by right-clicking and choosing "Save Target As..." from the context menu.)

Then open up PowerShell.

Compile the program with the "javac" utility and then run the bytecode file through the "java" interpreter to execute it, as shown below.

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS U:\>cd "My Documents"
PS U:\My Documents>cd compsci1
PS U:\My Documents\compsci1>ls *.java

 Volume in drive U is DATA01
 Volume Serial Number is E012-345E

 Directory of U:\My Documents\compsci1\

08/31/2011  12:40a               1,450 SineWave.java
               1 File(s)          1,450 bytes
               0 Dir(s)  53,887,197,184 bytes free

PS U:\My Documents\compsci1>javac SineWave.java
PS U:\My Documents\compsci1>ls SineWave.*

 Volume in drive U is DATA01
 Volume Serial Number is E012-345E

 Directory of U:\My Documents\compsci1\

08/31/2011  12:45a                 416 SineWave.class
08/31/2011  12:40a               1,450 SineWave.java
               2 File(s)          1,866 bytes
               0 Dir(s)  53,887,183,031 bytes free

PS U:\My Documents\compsci1>java SineWave
PS U:\My Documents\compsci1>



©2014 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License