# Scenario in Java

**URL:** <https://discourse.kitware.com/t/scenario-in-java/1367>\
**Category:** Pulse Physiology Engine\
**Created:** [September 23, 2024, 2:43pm UTC](https://discourse.kitware.com/t/scenario-in-java/1367 "2024-09-23T14:43:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GIONATHA\_PIROLA](https://discourse.kitware.com/user_avatar/discourse.kitware.com/gionatha_pirola/32/992_2.png) [@GIONATHA\_PIROLA](https://discourse.kitware.com/u/GIONATHA_PIROLA)\
**Post date:** [September 23, 2024, 2:43pm UTC](https://discourse.kitware.com/t/scenario-in-java/1367/1 "2024-09-23T14:43:05Z")

</div>

Hi,  
I was reading `HowTo_RunScenario.java`, and I would like to know if there is a way to export the created scenario to a JSON file.  
Afterward, I would like to load and run the exported file.

In `HowTo_RunScenario.cpp`, I noticed that scenarios are exported using the `SerializeToFile` method, but the `SEScenario` class in Java doesn’t seem to have this method.

Thank you

---

<div class="post-metadata">

**Author:** ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)\
**Post date:** [September 23, 2024, 3:00pm UTC](https://discourse.kitware.com/t/scenario-in-java/1367/2 "2024-09-23T15:00:25Z")

</div>

The API naming convention in Java is not normalized yet to the latest conventions,

Have you tried experimenting with the [readFile and writeFile methods in SEScenario](https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/java/com/kitware/pulse/cdm/scenario/SEScenario.java?ref_type=heads#L52)?

---

<div class="post-metadata">

**Author:** ![GIONATHA\_PIROLA](https://discourse.kitware.com/user_avatar/discourse.kitware.com/gionatha_pirola/32/992_2.png) [@GIONATHA\_PIROLA](https://discourse.kitware.com/u/GIONATHA_PIROLA)\
**Post date:** [September 23, 2024, 8:39pm UTC](https://discourse.kitware.com/t/scenario-in-java/1367/3 "2024-09-23T20:39:13Z")

</div>

I’ve just tried it, and it seems to work correctly with the `readFile` and `writeFile`.

Thank you!
