Search code examples
javalinuxtemplatesscriptingjsr223

Java Scripting (JSR223) = Bean/Script Shells for templating?


I have not yet used any "java scripting" (JSR223) and my question is related to linux (and windows).

Is there an easy way (after installing the scripting language and java) to do the following:

  1. Run a Script (in the respective language) that imports a template (=a file with placeholders/variables).
  2. That furthermore imports (read from filesystem) a config file with key=value pairs (java properties file)
  3. And fills in the placeholder with the key-value pairs.
  4. And writes the "merged" content into a file on the filesystem...

(This script should be easily be callable like "java scriptingenvironment scriptname myparameters")

Is this easily possible and/or have you done this before? And do you even know any links where this has been described/done before?

Thank you very much!!!!

Markus


Solution

  • This comes very close: https://developer.mozilla.org/en/Rhino_Shell