According to plugin documentation all old API and the RhinoJS engine are deprecated, I have to move to Graal.JS and APIv3.
I installed the Graal jars and linked them to the command line starting JOSM. On console I can see the message INFO: GraalVM is present ...
which makes me believe that the installation is successful.
After reading through the API documentation I thought I have figured out how to migrate my script, but running it failed with some “not found” error.
So I reduced the script to the very basic sample from the documentation:
import josm from 'josm'
josm.alert('num layers: ' + josm.layers.length)
Still, trying to run this with Graal selected as Engine gives me this error message:
Error: Error reading: D:\osm\josm\josm
This looks like it is failing to load josm.mjs
from the import.
Did I miss something on the installation? I was expecting that the scripting plugin somehow magically includes the es modules of the v3 API, so graal finds it.
If I manually extract the JS from the scripting jar and palce it in a folder besides josm, then it tries to search at another location which is not existing:
Error: Error reading: D:\es-module-repo\6ba5091e-5fe2-4445-8ded-873fcb00ca19\josm.mjs
What is the right way to use the script? JOSM latest, Java-17 and windows.
2 posts - 1 participant
Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/how-to-work-with-josm-scripting-plugin-and-apiv3/97297