CS 160 Lab #6

Do this lab with your buddy. One of you operates the console, the other types answers into a text editor window. Post your answers into a Track+ Issue in the CS160 project with the title "Lab 6 your name / your buddy's name".

  1. The GlassFish installation comes with Ant. It is installed in the ~/glassfish/lib/ant/bin directory (or maybe you installed it somewhere else). Add this directory to the PATH in cs160.profile, i.e. export PATH=...:$PATH. What is the contents of your cs160.profile now?
  2. Open a bash shell, run source cs160.profile file and type ant (or maybe ant.bat) What message do you get? (It will be an error message of some kind, but if you get "command not found", then first fix your PATH.
  3. Download the CheckStyle source into your Cygwin home directory and unzip:
    jar xvf checkstyle-src-4.2.zip
  4. Type
    cd checkstyle-src-4.2
    ant
    What happened? Where are the compiled files?
  5. Look inside build.xml. There is a target to run the GUI. Try it out. (Just bring up the checkstyle dialog.) Which ant command do you execute to launch the GUI version of checkstyle?
  6. Run
    ant xdocs
    What happens? Where is the documentation built? (Extra credit if you can explain the message: "warning: unmappable character for encoding UTF8")
  7. Download JTidy and unzip.
  8. Change into the project directory. Type
    ant
    What happened?
  9. If you used JDK 5.0, you should have received some error messages. The code uses enum as a variable name, but enum is a reserved word in JDK 5.0. However, the javac task has an option to specify the source and target versions for the compiler. Find the documentation for the javac task. (Hint: Google for ant javac). What URL describes the task?
  10. How do you fix the build.xml file so that the compilation will work even with JDK 5.0? (You are supposed to fix build.xml, not the source files.)
NOTE: A useful Ant tutorial is at  http://www.ibm.com/developerworks/edu/j-dw-java-apant-i.html