Compile and Run Java Programs from the command line
Windows Users: Install Putty and PSCP if you have not already done so.
Pre-Conditions
- You are remotely connected to a CS Linux workstation.
- Mac: ssh cslogin@best-linux.cs.wisc.edu
- Win: use PuTTY to connect to best-linux.cs.wisc.edu
- You have created a project directory on your CS Linux account (and you know where it is located).
- You have copied your local files to that directory.
Once you are connected (logged in) to a CS Linux workstation,
and have copied your program files to your CS account's program directory,
follow these instructions.
- Navigate to your CS directory to find files.
cd private/cs400/programs/practice
- List all files in current directory to confirm that your .java files are present.
ls -al
CAUTION: If the *.java files are not in the list, you will need to find them or copy them again.
- Compile your Java source code
javac *.java
- Run your Java program from command line and again with a command-line argument.
java Hello
java Hello Bucky
- Redirect your program's output to a file named results.txt
java TestSuite > results.txt
- review the contents of the results.txt file
cat results.txt
- Handin your program files as directed on the assignment page.