I want to debug the below js file using local rhino debugger.
math.js
var sb = new Packages.MathUtility();
// Add the 2 numbers
var a = sb.add(2, 3);
print(a);
//Subtract the 2 numbers
var s = sb.subtract(2, 3);
print(s);
//Multiply the 2 numbers
var m = sb.multiply(2, 3);
print(m);
//Divide the 2 numbers
var d = sb.divide(6, 3);
print(d);
MathUtility.java
public class MathUtility {
public MathUtility() {
}
public int add(int a, int b) {
return (a+b);
}
public int subtract(int a, int b) {
return (a-b);
}
public int multiply(int a, int b) {
return (a*b);
}
public int divide(int a, int b) {
return (a/b);
}
}
when i try to debug this through eclipse local rhino debugger it is thowing following error.
js: "C:\hiddenpath\math.js", line 1: uncaught JavaScript runtime exception: TypeError: [JavaPackage MathUtility] is not a function, it is object.
at C:\hiddenpath\math.js:1
Can any one please help me how will add any files to java script debugger classpath?