I am scripting java using rhino. I have few classes written in java that I am importing in javascript.
But, when I am validating javascript against JSLint, it invalidates javascript saying:
Problem at line 9 character 1: 'importPackage' was used before it was defined.
Here is the sample from my script:
importPackage(Packages.org.raj.test);
var test = "123";
I have selected the option: "Assume Rhino" as well but still, it shows up same error.
How should I deal with this problem?
Note that the ECMA standard doesn't cover communication with Java (or with any external object system for that matter).
I have explicitly added following line on top of my script
/*global importPackage: true */
and it works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With