# PulseJNI.so

**URL:** <https://discourse.kitware.com/t/pulsejni-so/1383>\
**Category:** Pulse Physiology Engine\
**Created:** [November 11, 2024, 4:54pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383 "2024-11-11T16:54:14Z")\
**Posts on this page:** 13\
**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:** [November 11, 2024, 4:54pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/1 "2024-11-11T16:54:14Z")

</div>

Hello everyone,  
I have created a Java application using Pulse, and it works correctly on Windows with the PulseJNI.dll. However, I would like it to work on Linux as well, and for that, I need the PulseJNI.so library. I tried building the source using xcompile.sh (the script for dockcross compile), but I wasn’t able to obtain the library.  
Does anyone know how to proceed?

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:** [November 11, 2024, 5:01pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/2 "2024-11-11T17:01:46Z")

</div>

If you have a windows machine, just run the xcompile.bat  
If you are using xcompile.sh, you are on a linux box, so you could just build there  
xcompile.sh is rarely used, so it also might have some issues from lack of use…

---

<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:** [November 12, 2024, 12:01pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/3 "2024-11-12T12:01:24Z")

</div>

I’ve tried running both the `.bat` and `.sh` scripts, but I wasn’t able to obtain the `PulseJNI.so` file with either of them. For reference, I’m working on the `ventilator-updates` branch.

---

<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:** [November 12, 2024, 1:55pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/4 "2024-11-12T13:55:23Z")

</div>

Oh!  
Right right, sorry, the Java build is not enabled in the xcompile scripts  
But I did just do this for someone else…

I have a few things to cover off this morning, but I should be able to get something back to you today

---

<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:** [November 20, 2024, 3:12pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/5 "2024-11-20T15:12:39Z")

</div>

Hey @GIONATHA_PIROLA

Turns out to get the libJavaJNI.so to build I did a lot of ad hoc configuration that is not easily reproducable…

SO, I converted our dockcross scripts to CMake so it is easier to configure the build system for various configurations.

This is pushed up to the integration branch (soon to be Pulse 4.3.1 patch)

Same process to build, just run `xcompile.bat`  
To get libPulseJNI.so for an android64 system just [change this to ON](https://gitlab.kitware.com/physiology/engine/-/blob/integration/xcompile.bat?ref_type=heads#L13), before you run the script and you should be good to go!

---

<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:** [November 20, 2024, 3:22pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/6 "2024-11-20T15:22:08Z")

</div>

Ok, thank you!  
I will look into that in the next few days and update you if it works.

---

<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:** [November 20, 2024, 6:04pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/7 "2024-11-20T18:04:39Z")

</div>

I attempted to build the entire code from the integration branch using `xcompile.bat`, but I believe there is an issue. I am unable to retrieve the `PulseJNI.so` (or `.dll`), or even the `PulseC` files. The script stops after about 10 minutes, which suggests there may be a problem.

---

<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:** [November 20, 2024, 6:11pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/8 "2024-11-20T18:11:32Z")

</div>

Try piping the output to a file and we can take a look

`xcompile.bat > build.txt`

---

<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:** [November 20, 2024, 6:12pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/9 "2024-11-20T18:12:12Z")

</div>

FYI, it will be named `libPulseJNI.so`

---

<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:** [November 20, 2024, 7:44pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/10 "2024-11-20T19:44:46Z")

</div>

I think it’s working now. I’m not sure, but maybe I had something wrong in my directory earlier. Currently, the build is running. I’ll update you tomorrow to confirm if `libPulseJNI.so` is working correctly. Thank you!

---

<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:** [December 3, 2024, 11:22am UTC](https://discourse.kitware.com/t/pulsejni-so/1383/11 "2024-12-03T11:22:24Z")

</div>

Hi,  
Sorry for my late response.  
I have tried the `libPulseJNI.so` library, and it works, but I have an issue with the simulation.  
I have the same app for Windows and Linux, with the only difference being the JNI file.

For example, on Windows, when I execute `ps.advanceTime(time)` (with `time = 1 min`), the Pulse engine halts at this command for one minute. However, on Linux, using the same command, the system runs for only a few seconds instead of one minute.

Could this be a bug?

---

<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:** [December 3, 2024, 1:51pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/12 "2024-12-03T13:51:04Z")

</div>

That is indeed a bug that we have fixed on the [integration branch](https://gitlab.kitware.com/physiology/engine/-/commit/feadaf85094d3febc8ea929281a1192ba32b0b46)

If you have that code, you should be able to rerun CMake with its build directory set to your InnerBuild directory.

You can check that Pulse is optimizing by right clicking Pulse in MSVC and going to properties and check the Optimization options

 ![image](https://discourse.kitware.com/uploads/default/original/2X/b/bd95339886a9005da207e680adb1c498c94cff7c.png)

---

<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:** [December 3, 2024, 3:22pm UTC](https://discourse.kitware.com/t/pulsejni-so/1383/13 "2024-12-03T15:22:33Z")

</div>

Ok, now it works fine.  
Thank you!
