When HEC-RTS is updated, certain function locations or module names may change, causing your existing scripts to fail. Follow these steps to identify and fix these broken imports using the built-in JavaDocs.

This tutorial uses the Script Editor found in HEC-RTS, but any IDE will work.

Step 1: Identify the Error 

  1. Launch HEC-RTS.
  2. From the Script menu, select Editor.
  3. Select a script from the tree on the left of the dialog.
  4. Run the script.
  5. Check the console output for "undefined" or "not found" errors.
  6. Note the specific name of the failing function or class.
    1. In the example above, MessageBox is not defined. 

Step 2: Locate the New Class Path

Since the script no longer knows where the function lives, you must look it up in the software's documentation.

  1. Navigate to the HEC-RTS installation folder on your computer.
  2. Open the HEC-RTS/JavaDocs folder and double-click index.html. This opens the documentation in your default browser.
  3. Click INDEX at the top of the page.
  4. Use Ctrl+ F to search for the undefined object (e.g., MessageBox).
  5. Identify the Package and look for the class associated with that name.
    1. In the example above, MessageBox is now located under hec.script.
  6. Now that we have found our function of interest, we can select it and will take us to the page showing the package and class information. 
    1. The Package will be used in the first portion of the import statement while the Class is what we are trying to import
    2. In this example, we could adjust out import to "From hec.script import MessageBox"

Step 3: Update and Validate the Script

Once you have the correct package path, return to the Script Editor.

  1. Update the import statement to reflect the new location.
    1. An example of a single import: from hec.script import MessageBox
    2. An example of multiple imports: from hec.script import MessageBox, HecDSS
  2. If you are using wildcard imports (e.g., from hec.script import *), ensure the class you found in the JavaDocs actually resides within that package. If not, add a specific import line for the missing class.
  3. Click Save and Run to execute the script.

Step 4: Refine as Needed

If the error persists, you may have found a class shared by multiple packages. Use trial and error with the paths found in the JavaDocs until the script runs successfully.