I am trying to use Rhino to covert some JavaScript code to Java. As anyone who has any experience at all with JavaScript knows "document" is used for lots of things. So, it is used in various functions in the code I am using. However, when I execute Rhino it just gives me this error js: uncaught JavaScript runtime exception: ReferenceError: "document" is not defined.
Does anyone know what is causing this? And if so how to fix it? I am using Rhino version 1.7 on Ubuntu 14.10 64 bit.
Or if anyone could atleast show me how to evaluate JavaScript from within Java. I have done some research, but the code never works.