Easy to load your script from URL. Use the embedded script as JavaScript. And in the Js write load('http://www.....')
See nashorn extensions for the load() function.
Edit: you can also do load('classpath:myJsFile.js')
which will load the js files sitting in your lib folder/classpath