在Eclipse中如何设置Rhino调试器插件的classpath? [英] How set classpath for Rhino debugger plugin in Eclipse?

查看:267
本文介绍了在Eclipse中如何设置Rhino调试器插件的classpath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我在Eclipse中使用Rhino插件。要在JavaScript中使用Java类,只要使用RT.JAR中的类就没有问题。



但是,只要我想使用我的类自定义类,那么问题由于类路径而开始。



我做的步骤


  1. 将一个类放入一个JAR文件中。
  2. 将其添加到Eclipse中的外部JAR文件中。

  3. 将其用于JavaScript文件,并在Eclipse中将其调试为Rhino调试器。

  4. 由于类没有定义错误,由于类路径设置不正确。

错误

  js:未捕获JavaScript运行时异常:ReferenceError:Temp未定义。 

JavaScript文件

  importPackage(java.lang中); 
importPackage(Packages.my);
var a = new Temp();
System.out.println(java.lang.System.getProperty(java.class.path));

我的观点: -


$ b犀牛调试器配置中的$ b $ ol
  • 只有两个或三个变量,如 ECLIPSE_HOME JRE_LIB JRE_ext 。所以只有这些变量的值才被Rhino调试器使用。

  • 然后使用<$ c $打印 classpath c> Systemclass 函数,然后只打印Eclipse / plugin文件夹中Rhino JAR文件的类路径。

  • 现在,我该怎么办?

    解决方案

    问题已经解决了。 Rhino的编辑来源上传回Eclipse,所以很快它可能是Eclipse的一部分。


    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

    1. make a class and put it into a JAR file.
    2. add it 'jar' into an external JAR file in Eclipse.
    3. use it into a JavaScript file and debug it as Rhino debugger in Eclipse.
    4. 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 :-

    1. 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.
    2. then print value of classpath by using the Systemclass function, and then only print the classpath of the Rhino JAR file which is in the Eclipse/plugin folder.

    Now, what should I do?

    解决方案

    The problem has been solved. The edited source of Rhino is uploaded back to Eclipse, so soon it may be the part of Eclipse.

    这篇关于在Eclipse中如何设置Rhino调试器插件的classpath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆