I advise using the Nashorn script engine with the jjs -fx
command running JavaScript coded JavaFX scripts.
- Nashorn is a much more modern JavaScript engine than Rhino.
- Nashorn has convenience features for launching JavaFX JavaScript scripts.
- Nashorn is included in Java 8 and Rhino will be removed from Java 8.
There is an example of using Nashorn with JavaFX which should help you get started.
Java 8 early access releases including Nashorn and JavaFX can be downloaded from: https://jdk8.java.net/download.html
Regarding your JavaFX runtime issue, it is probably because you are using Java7 where the JavaFX runtime is not on your runtime classpath. Search your JRE location for jfxrt.jar and add the location returned to your runtime classpath. This is not an issue with Java 8, which includes JavaFX on the runtime classpath.