Hot reload JOSM plugin during dev?

Ben Ritter benjaminaritter at gmail.com
Thu Jun 22 04:46:27 UTC 2023


Hi josm-dev,

I am in the very early stages of building a JOSM plugin that will use the
osm2streets <https://github.com/BudgieInWA/JOSM2Streets/> rust library to
display street and lane shapes. (The rust library is loaded via JNI and
called into from Java). During the prototyping stages of the plugin, and of
the rust library, the startup time of JOSM is getting in the way. My
problem is discussed in a little more detail at
https://github.com/BudgieInWA/JOSM2Streets/issues/1

Is there a mechanism that we can use to either

   1. hot reload a plugin, or
   2. unload a loaded plugin, (so that the new version can subsequently be
   loaded)?

My other line of investigation is having the plugin itself unload and
reload some internal class using Class Loaded shenanigans
<https://web.archive.org/web/20140704120535/http://www.codethesis.com/blog/unload-java-jni-dll>.
It should be possible to unload and reload the class wrapping the native
part of the plugin at the press of a button. Has anyone done this sort of
thing or have reference to some "hot reload" library that provides this
functionality with a nice API?

Any suggestions as to where I should focus my research on this would be
appreciated.

Cheers,
Ben Ritter
BudgieInWA

---

https://github.com/BudgieInWA/JOSM2Streets/
https://web.archive.org/web/20140704120535/http://www.codethesis.com/blog/unload-java-jni-dll


More information about the josm-dev mailing list