如何获取通过 rhino shell 命令行运行的 javascript 文件的路径
如何获取通过 rhino shell 命令行运行的 javascript 文件的路径?
例如: java -jar js.jar /path/to/this/file.js
我想得到 /path/to/this/file.js
,有什么想法吗?
how do you get the path of the javascript file run through the rhino shell commandline?
eg: java -jar js.jar /path/to/this/file.js
i would like to get /path/to/this/file.js
, any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为如果没有一些 Java 是不可能的。
jsdoc 通过使用一个包装 rhino 并插入所述路径的类来解决这个问题(尽管它有点错误)。您可以找到它的代码(以及运行它的 shell 脚本位于 trunk 中): http://code.google.com/p/jsdoc-toolkit/source/browse/trunk/jsdoc-toolkit/java/src/JsRun.java
I do not think it is possible without some Java.
jsdoc solves it by using a class that wraps rhino and inserts said path (though its a bit buggy). You can find its code (and a shell script that runs it is in the trunk): http://code.google.com/p/jsdoc-toolkit/source/browse/trunk/jsdoc-toolkit/java/src/JsRun.java