Repository: synthetichealth/synthea
Issue: Running synthea via .jar release with config "physiology.state.enabled=true" throws java.io.FileNotFoundException

### What happened?

Downloading `synthea-with-dependencies.jar` and running `java -jar ./synthea-with-dependencies.jar --physiology.state.enabled true` throws `java.io.FileNotFoundException: /physiology/models/circulation/McSharry2003_Synthetic_ECG.xml`

Cloning the repository and running `./run_synthea --physiology.state.enabled=true` works.


### Environment

```markdown
- OS: macOS 13.3.1
- Java: openjdk 17.0.7
```


### Relevant log output

```shell
Loading module modules/epilepsy.json
Loading module modules/female_reproduction.json
Loading module modules/fibromyalgia.json
Loading module modules/food_allergies.json
Loading module modules/gallstones.json
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
java.lang.RuntimeException: java.io.FileNotFoundException: /physiology/models/circulation/McSharry2003_Synthetic_ECG.xml (No such file or directory)
        at org.mitre.synthea.engine.PhysiologySimulator.<init>(PhysiologySimulator.java:202)
        at org.mitre.synthea.engine.State$Physiology.setup(State.java:350)
        at org.mitre.synthea.engine.State$Physiology.initialize(State.java:345)
        at org.mitre.synthea.engine.State.build(State.java:123)
        at org.mitre.synthea.engine.Module.<init>(Module.java:327)
        at org.mitre.synthea.engine.Module.loadFile(Module.java:218)
        at org.mitre.synthea.engine.Module.lambda$walkModuleTree$0(Module.java:141)
        at org.mitre.synthea.engine.Module$ModuleSupplier.get(Module.java:507)
        at org.mitre.synthea.engine.Module.lambda$getModules$4(Module.java:261)
        at java.base/java.util.TreeMap.forEach(TreeMap.java:1282)
        at org.mitre.synthea.engine.Module.getModules(Module.java:257)
        at org.mitre.synthea.engine.Generator.init(Generator.java:276)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:211)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:187)
        at App.main(App.java:233)
Caused by: java.io.FileNotFoundException: /physiology/models/circulation/McSharry2003_Synthetic_ECG.xml (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at org.sbml.jsbml.xml.stax.SBMLReader.readSBML(SBMLReader.java:302)
        at org.sbml.jsbml.xml.stax.SBMLReader.readSBML(SBMLReader.java:288)
        at org.mitre.synthea.engine.PhysiologySimulator.<init>(PhysiologySimulator.java:200)
        ... 14 more
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: /physiology/models/circulation/McSharry2003_Synthetic_ECG.xml (No such file or directory)
        at org.mitre.synthea.engine.Module$ModuleSupplier.get(Module.java:517)
        at org.mitre.synthea.engine.Module.lambda$getModules$4(Module.java:261)
        at java.base/java.util.TreeMap.forEach(TreeMap.java:1282)
        at org.mitre.synthea.engine.Module.getModules(Module.java:257)
        at org.mitre.synthea.engine.Generator.init(Generator.java:276)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:211)
        at org.mitre.synthea.engine.Generator.<init>(Generator.java:187)
        at App.main(App.java:233)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /physiology/models/circulation/McSharry2003_Synthetic_ECG.xml (No such file or directory)
        at org.mitre.synthea.engine.PhysiologySimulator.<init>(PhysiologySimulator.java:202)
        at org.mitre.synthea.engine.State$Physiology.setup(State.java:350)
        at org.mitre.synthea.engine.State$Physiology.initialize(State.java:345)
        at org.mitre.synthea.engine.State.build(State.java:123)
        at org.mitre.synthea.engine.Module.<init>(Module.java:327)
        at org.mitre.synthea.engine.Module.loadFile(Module.java:218)
        at org.mitre.synthea.engine.Module.lambda$walkModuleTree$0(Module.java:141)
        at org.mitre.synthea.engine.Module$ModuleSupplier.get(Module.java:507)
        ... 7 more
Caused by: java.io.FileNotFoundException: /physiology/models/circulation/McSharry2003_Synthetic_ECG.xml (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at org.sbml.jsbml.xml.stax.SBMLReader.readSBML(SBMLReader.java:302)
        at org.sbml.jsbml.xml.stax.SBMLReader.readSBML(SBMLReader.java:288)
        at org.mitre.synthea.engine.PhysiologySimulator.<init>(PhysiologySimulator.java:200)
        ... 14 more
```


Changed files:
src/main/java/org/mitre/synthea/engine/PhysiologySimulator.java

diff --git a/src/main/java/org/mitre/synthea/engine/PhysiologySimulator.java b/src/main/java/org/mitre/synthea/engine/PhysiologySimulator.java
index 15e0aa79f..1e59455c5 100755
--- a/src/main/java/org/mitre/synthea/engine/PhysiologySimulator.java
+++ b/src/main/java/org/mitre/synthea/engine/PhysiologySimulator.java
@@ -7,8 +7,6 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
-import java.net.URISyntaxException;
-import java.net.URL;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -25,6 +23,7 @@ import org.apache.commons.math.ode.DerivativeException;
 import org.mitre.synthea.helpers.ChartRenderer;
 import org.mitre.synthea.helpers.ChartRenderer.MultiTableChartConfig;
 import org.mitre.synthea.helpers.ChartRenderer.MultiTableSeriesConfig;
+import org.mitre.synthea.helpers.Utilities;
 import org.sbml.jsbml.Model;
 import org.sbml.jsbml.SBMLDocument;
 import org.sbml.jsbml.SBMLException;
@@ -51,11 +50,8 @@ import org.yaml.snakeyaml.constructor.Constructor;
  */
 public class PhysiologySimulator {
 
-  private static final URL MODELS_RESOURCE = ClassLoader.getSystemClassLoader()
-      .getResource("physiology/models");
   private static final Map<String, Class<?>> SOLVER_CLASSES;
   private static Map<String, Model> MODEL_CACHE;
-  private static Path SBML_PATH;
   private static Path OUTPUT_PATH = Paths.get("output", "physiology");
 
   private final Model model;
@@ -151,24 +147,10 @@ public class PhysiologySimulator {
     // Make unmodifiable so it doesn't change after initialization
     SOLVER_CLASSES = Collections.unmodifiableMap(initSolvers);
 
-    try {
-      SBML_PATH = Paths.get(MODELS_RESOURCE.toURI());
-    } catch (URISyntaxException ex) {
-      throw new RuntimeException(ex);
-    }
-
     // Initialize our model cache
     MODEL_CACHE = new HashMap<String, Model>();
   }
 
-  /**
-   * Sets the path to search for SBML model files.
-   * @param newPath new path to use
-   */
-  public static void setModelsPath(Path newPath) {
-    SBML_PATH = newPath;
-  }
-
   /**
    * Sets the path to place main simulation results in.
    * @param newPath new path to use
@@ -192,12 +174,11 @@ public class PhysiologySimulator {
       model = MODEL_CACHE.get(modelPath);
     } else {
       // Load and instantiate the model from the SBML file
-      Path modelFilepath = Paths.get(SBML_PATH.toString(), modelPath);
       SBMLReader reader = new SBMLReader();
-      File inputFile = new File(modelFilepath.toString());
       SBMLDocument doc;
       try {
-        doc = reader.readSBML(inputFile);
+        String sbmlContent = Utilities.readResourceOrPath("physiology/models/" + modelPath);
+        doc = reader.readSBMLFromString(sbmlContent);
       } catch (IOException | XMLStreamException ex) {
         throw new RuntimeException(ex);
       }