命令行Google Closure提供的标准extern是什么,以及如何通过Java接口获得它们
What are the standard externs provided by the command line Google Closure, and how do I get them through the Java interface?
我现在正在使用这个代码:
com.google.javascript.jscomp.Compiler.setLoggingLevel(Level.OFF);
com.google.javascript.jscomp.Compiler compiler = new com.google.javascript.jscomp.Compiler();
CompilerOptions options = new CompilerOptions();
CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
WarningLevel.VERBOSE.setOptionsForWarningLevel(options);
List<JSSourceFile> externs = new ArrayList<JSSourceFile>();
externs.add(JSSourceFile.fromFile(extern_src));
List<JSSourceFile> primary = new ArrayList<JSSourceFile>();
primary.add(JSSourceFile.fromFile(tmp));
compiler.compile(externs, primary, options);
然而,我得到很多这样的错误:
Error message: JSC_UNDEFINED_VARIABLE. variable Array is undefined
Error message: JSC_UNDEFINED_VARIABLE. variable TypeError is undefined
Error message: JSC_UNDEFINED_VARIABLE. variable Object is undefined
Error message: JSC_UNDEFINED_VARIABLE. variable arguments is undefined
Error message: JSC_UNDEFINED_VARIABLE. variable Number is undefined
Error message: JSC_UNDEFINED_VARIABLE. variable Math is undefined
显然,这些是不正确的:像Object
和arguments
等东西是语言的核心部分。我能做些什么来解决这个问题?
您看过Michael Bolin关于使用Java API的博客了吗?
http://blog.bolinfest.com/2009/11/calling-closure-compiler-from-java.html相关文章:
- DOM事件通过JSON转换为java
- 通过GWT JSNI传递Java对象时出错
- MAC操作系统-如何通过Java类运行应用程序(.app)
- Rad网格编辑模式通过选中复选框时的java脚本启用禁用所需的字段验证器
- 如何通过子进程连接Java应用程序后在node.js中编写文件
- 如何通过jsp表达式标记将java字符串变量传递给javascript函数
- 如何通过java脚本限制粘贴文本框(Aspx.page)中的整数或字符值
- 通过javascript用java处理excel文件
- 通过Java加载XML并制作HTML DOM的一部分
- 使用Java脚本跟踪网页中是否有Ajax请求,或者通过Selenium Web驱动程序拦截XMLHttpRequest
- 通过文本字段中的输入值使用Java Script计算金额
- 通过Node中间人将表单数据发送到Java服务器
- 通过jquery从java下载文件
- 通过java脚本传递参数来表达node.js
- Selenium Java-通过JavascriptExecutor获取页面源代码
- 如何在客户端通过多个字段对java对象进行排序
- 如何在java中通过电子邮件发送渲染的html文件
- 使用java脚本通过网页保存Excel文件
- 数据无法通过 Java Servlet 的问题
- 如何通过Java脚本将PHP值从一个文件传递到另一个文件