Java - Web Delivery (Web Start)

Last updated April 01, 2013

Table of Contents

1. Introduction

You can deliver CTAT Java tutors—both Cognitive and Example-tracing Tutors—over the Web using the Java Web Start technology. This technology is free, and is included with the Java Runtime Environment (JRE).

To access your tutor, a student or other end user clicks a link in a web browser. The browser then launches Java Web Start, which downloads the entire tutor application to the user's desktop and runs the tutor. After this process, the tutor looks and behaves exactly as it does when running on a desktop computer.

2. Prerequisites

To use Java Web Start with CTAT, you must ensure that you've:

  • Installed the Java SDK (JDK)
  • Built a Java-language student interface in a package folder under {CTAT}/Projects/;
  • Created one or more Behavior Graphs (.BRD files) for your student interface
  • (Optional / Cognitive tutors only) Created and placed Jess files wmeTypes.clp, productionRules.pr and *.WME files (one .WME for each .BRD) in your package folder under Projects/; this should be the default location of these files
  • Installed Apache Ant
  • Installed and configured a web server to which you can transfer files and folders.

If you have any questions about any of these requirements, feel free to contact us.

3. Procedure

You will now create the necessary files for delivering your tutor. This process is done from the command line by interacting with a sequence of Ant targets.

Note: You will need to set the environment variables ANT_HOME and JAVA_HOME. ANT_HOME should point to the directory where Ant is installed. JAVA_HOME should point to your Java Development Kit (JDK) installation.

In this example:

  • The package folder under Projects/ was AdditionTutorChaining/.
  • The behavior graph was Projects/AdditionTutorChaining/problems/start.brd.
  • Jess files were in Projects/AdditionTutorChaining/CognitiveModel.
  • The web server was fuji.pslc.cs.edu; the top-level folder on the web server was htdocs.
    The login name was ctat.
    The corresponding URL was http://fuji.pslc.cs.cmu.edu/ctat/, and all files were in that folder. The resulting URL for the tutor was http://fuji.pslc.cs.cmu.edu/ctat/AdditionTutorChaining.html.
  • The starting directory was the CTAT installation directory, {CTAT}.

To deliver the example tutor AdditionTutorChaining:

  1. From the command line, we change to the deploy directory under CTAT:
    $ cd deploy-tutor
  2. Edit the file build.properties with a text editor, substituting your server information:
    server=fuji.pslc.cs.cmu.edu
    server-dir=ctat
    server-login=ctat
    default-codebase=http://${server}/${server-dir}/
  3. Start the first interactive Ant target:
    $ ant clean deploy-jars
    Type your answers at the prompts. If you don't wish to set up logging, press enter at each prompt:
    edit-preference:
        [input] Enter value for Log to Remote Server;
        [input] value must be true or false
        [input] (leave empty for default value "false")
    
    edit-preference:
        [input] Enter value for Logging Server URL;
        [input] value must be a URL
        [input] (leave empty for default value "http://learnlab.web.cmu.edu/log")
    
    edit-preference:
        [input] Enter value for Log to Disk;
        [input] value must be true or false
        [input] (leave empty for default value "false")
    
    edit-preference:
        [input] Enter value for Disk Logging Directory;
        [input] value must be a directory path on client machines; e.g. C:/temp/log
        [input] (leave empty for default value ".")
    
    edit-preference:
        [input] Enter value for Use Login Window;
        [input] value must be true or false
        [input] (leave empty for default value "false")
    After a set of Signing JAR... messages, you'll see:
    [echo] ************
    [echo] Transfer the entire tree of .jar files in _tmpjar/ to
    [echo] ctat@fuji.pslc.cs.cmu.edu:ctat/lib 
    [echo] ************
  4. Using your desired file transfer utility, move the contents (including subfolders) of the folder deploy-tutor\_tmpjar to the web server (logged in as ctat), folder htdocs/ctat/lib.
  5. Start the second interactive Ant target:
    $ ant build-only
    Type your answers at the prompts, keeping in mind the following:
    • Use forward slashes (/) in each path;
    • Use no spaces in the name of the tutor; and
    • All paths are relative to Projects/, except for the 'main class of the tutor', which is relative to the tutor folder.
    [input] Enter descriptive name of tutor: 
      AdditionTutorChaining
    
    [input] Enter tutor folder (relative to Projects/ folder):
      AdditionTutorChaining
    
    [input] Enter main class of tutor (relative to Projects/AdditionTutorChaining: 
      TutorInterface
    
    [input] Enter brd file (relative to Projects/ folder) 
    BE SURE TO USE FORWARD SLASHES! (/) :
      AdditionTutorChaining/problems/start.brd
    
    [input] Enter school name:
      CMU
    
    [input] Enter course name:
      Example Tutors
    
    [input] Enter unit name:
      Arithmetic
    
    [input] Enter section name:
      Addition
    
    [input] Enter "P" for Production System mode 
    (leave empty for default Example Tracing):(,E,e,P,p)
      P
    
    [input] Enter codebase (leave empty for default http://fuji.pslc.cs.cmu.edu/ctat/: 
    [http://fuji.pslc.cs.cmu.edu/ctat/]
    After some messages you should see:
         [echo] Next, transfer these files to
     ctat@fuji.pslc.cs.cmu.edu:ctat:
         [echo] temp/AdditionTutorChaining.jar
         [echo] temp/AdditionTutorChaining.jnlp
         [echo] temp/AdditionTutorChaining.html
  6. Using your desired file transfer utility, move those files in the folder deploy-tutor\temp to the web server (logged in as ctat), folder htdocs/ctat.

4. Test

You're now ready to access your tutor over the web.

Launch a web browser and navigate to the web address associated with the path to which you transferred your files. Load the generated HTML file—it will have the same name as your tutor's 'descriptive name', such as AdditionTutorChaining.html—and click the link on the web page titled Click here to start the tutor.

Depending on how your web server is configured, the following page that loads may either prompt you to save or open the file, or it will load as text. If it loads as text, save the file (preserving the JNLP extension) and open it with the Java Runtime Environment (JRE); it you're prompted to save or open file, save it to your computer and open it with the JRE.

When Web Start launches, you should see a splash screen followed by a screen with a progress bar and status messages:

Java Web Start

Java Web Start: downloading the files required to run AdditionTutorChaining

Your tutor will then launch. If there are errors in the process, Java Web Start will display them. If the errors prevent your tutor from running, note the error message(s) and quit Java Web Start. Depending on the message, you may need to open the JNLP file with a text editor and verify that the paths and file names are accurate. If you can't resolve the problem, contact us with the error message and we'll help you troubleshoot the issue.