问题
Actually I am using the Rhino plugin in Eclipse. To use a Java class in JavaScript there is no problem when I just use class which is in RT.JAR.
But whenever I want to use my class' "custom classes" then the problem begins due to the classpath.
Steps made by me
- make a class and put it into a JAR file.
- add it 'jar' into an external JAR file in Eclipse.
- use it into a JavaScript file and debug it as Rhino debugger in Eclipse.
- error due to class not defined, "Due to class path is not set properly".
The error
js: uncaught JavaScript runtime exception: ReferenceError: "Temp" is not defined.
JavaScript file
importPackage(java.lang);
importPackage(Packages.my);
var a=new Temp();
System.out.println(java.lang.System.getProperty("java.class.path"));
My view :-
- in the Rhino debugger configuration there are only two or three variables, like
ECLIPSE_HOME
,JRE_LIB
,JRE_ext
. So only the value of these variables are used by the Rhino debugger. - then print value of
classpath
by using theSystemclass
function, and then only print the classpath of the Rhino JAR file which is in the Eclipse/plugin folder.
Now, what should I do?
回答1:
The problem has been solved. The edited source of Rhino is uploaded back to Eclipse, so soon it may be the part of Eclipse.
来源:https://stackoverflow.com/questions/7471093/how-set-classpath-for-rhino-debugger-plugin-in-eclipse