Index: trunk/src/scriptbuilder/gui/application.properties
===================================================================
--- trunk/src/scriptbuilder/gui/application.properties	(revision 155)
+++ trunk/src/scriptbuilder/gui/application.properties	(revision 158)
@@ -1,7 +1,7 @@
-#Wed, 20 Nov 2019 16:03:11 -0800
+#Fri, 22 Nov 2019 17:54:32 -0800
 
-Application.revision=154
+Application.revision=156
 
-Application.buildnumber=43
+Application.buildnumber=52
 
 Incidents.directory=Incidents
Index: trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
===================================================================
--- trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java	(revision 157)
+++ trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java	(revision 158)
@@ -16,11 +16,16 @@
 import java.awt.event.WindowEvent;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.FileNotFoundException;
+import java.io.InputStream;
 import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.Observable;
 import java.util.Observer;
 import java.util.Properties;
 import java.util.Random;
+import java.util.Scanner;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -52,5 +57,5 @@
 public class ScriptBuilderFrame extends javax.swing.JFrame implements Observer
 {
-
+    private final static String kUnitsFilename = "resources/units_template.xml";
     /**
      * The script model.
@@ -156,4 +161,5 @@
         script.addObserver(this);
         initComponents();
+        loadCHPunits();
         addCustomListeners();
         //add to listener helper method
@@ -179,13 +185,27 @@
 
     }
-    
+    /** Load the template file of standard CHP units into the script.
+     *  These units generally appear before any script events.
+     */
+    private void loadCHPunits()
+    {
+        // Read the file of CHP unit names
+        // This works within NetBeans or it can be run from the Jar file.
+        URL url = this.getClass().getResource("/"+kUnitsFilename);
+        InputStream inStream;
+        try {
+            inStream = url.openStream();
+            script.loadUnitsFromFile(inStream);
+        } catch (IOException ex) {
+            Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
+        }   
+    }
     /**
      * Put all custom non-generated listeners in this method
      */
     private void addCustomListeners(){
-        
-        String fileName = "src/resources/units_template.xml";
-        File unitFile = new File(fileName);
-        script.loadUnitsFromFile(unitFile);
+
+
+
         //listener for window closing
         this.addWindowListener(new WindowAdapter(){
@@ -2215,7 +2235,5 @@
     {//GEN-HEADEREND:event_fileNewActionPerformed
         script = new SimulationScript();
-        String fileName = "units.xml";
-        File f = new File(fileName);
-        script.loadUnitsFromFile(f);
+        loadCHPunits();
         script.update();
         this.update(null, script);
@@ -2395,6 +2413,20 @@
         if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
         {
-            //load script with values from the selected file
-            script.loadUnitsFromFile(fc.getSelectedFile());
+            InputStream is = null;
+            try {
+                // create an input stream from the selected file
+                File pf = fc.getSelectedFile();
+                is = new FileInputStream(pf);
+                //load script with units from the selected file
+                script.loadUnitsFromFile(is);
+            } catch (FileNotFoundException ex) {
+                Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
+            } finally {
+                try {
+                    is.close();
+                } catch (IOException ex) {
+                    Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
+                }
+            }
         }
     }//GEN-LAST:event_loadUnitsActionPerformed
