Compiling and Running Applications
Compiling The Application
- We want the .class files for this application to be in a different directory than the .java files for this project. This is the way it will be for all exercises and projects for this semester. You could compile the file and then move the .class file each time but this would be very tedious. There is an easier way!
- We are going to use the Apache Foundation tool named ant to perform all compiling during the semester. We’ll also use it to run tests. We will run most labs and the Analyzer application with run scripts.
Compiling Your Applications
All compiling will be done with ant.
Compiling your labs.
- Navigate to your
projects
directory. - To compile all of your labs run the following command at the prompt.
$ ant compile_labs
- To compile and build your labs run the following at the prompt.
$ ant build_labs
- Note: The build_labs command will first compile your labs before it builds the .jar file. Use this most of the time.
Compiling the Analyzer application.
- Navigate to your
projects
directory. - To compile the application run the following command at the prompt.
$ ant compile_analyzer
- To build the analyzer.jar file run the following command at the prompt.
$ ant build_analyzer
- Note: The build command will also compile the application. Most of the time you should just use the build command.
Running Your Applications
We will use scripts to run the applications this semester. We will always run command line applications from the projects directory. Follow these steps:
Running the Analyzer Application
- Download this file and place it in your
projects
directory. Right-click and “Save Link As…” (runAnalyzer.sh). - Navigate to your
projects
directory and enter this command on the terminal command line:$ chmod +x runAnalyzer.sh
- This script will be used to run the Analyzer application.
$ ./runAnalyzer.sh <file path>
Running Unit 1 Labs
- Download this file and place it in your
projects
directory. Right-click and “Save Link As…” (runLabs1.sh). - Navigate to your
projects
directory and enter this command on the terminal command line:$ chmod +x runLabs1.sh
- This script will be used to run the labs in Unit 1.
$ ./runLabs1.sh
Running Demo Code
- It may be helpful to also create a directory and run script for any demo code that you write along with the video demos. You can find demo code and the related script in GitHub.