抛出java.lang.ClassNotFoundException:com.google,javascript.jscomp.SourceFile [英] java.lang.classnotfoundexception: com.google,javascript.jscomp.SourceFile

查看:726
本文介绍了抛出java.lang.ClassNotFoundException:com.google,javascript.jscomp.SourceFile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从传递标志 language_in = ECMASCRIPT5 我使用下面的脚本.bat文件调用关闭编译器,但我收到一条错误

 抛出java.lang.ClassNotFoundException:com.google,javascript.jscomp.SourceFile

我想知道:


  • 当我省略了标志code编译很好,所以我在传递正确的标志?

  • 你能向我提供有关此错误的更多信息?


 的java -Xms256m -Xmx256m -cp%〜DP0 ../ ShrinkSafe的/ js.jar;%〜DP0 ../ closureCompiler / compiler.jar --language_in = ECMASCRIPT5 ;%〜DP0 ../ ShrinkSafe的/ shrinksafe.jarorg.mozilla.javascript.tools.shell.Main%〜DP0 ../../道场/的dojo.js的baseUrl =%〜DP0 .. /../dojo负载=建立%*


解决方案

作为的文档


  

(ClassNotFoundException异常)抛出该异常当应用程序试图通过使用字符串名加载类:


  
  

      
  • 在Class类中的forName方法。

  •   
  • 在类的ClassLoader中的findSystemClass方法。

  •   
  • 在ClassLoader类中的loadClass方法。

  •   

我觉得它的发生,因为事实上,当你省略标志code ++工程,是变量 ECMASCRIPT5 的compiler.jar内部被定义,你可能不会包括在classpath中。

您可以尝试把compiler.jar到你的WEB-INF / lib目录,以便它能够与您的应用程序上访问执行时部署等。

I need to call Closure Compiler from a .bat file passing a flag language_in=ECMASCRIPT5 I am using the following script but I receive an error

java.lang.classnotfoundexception: com.google,javascript.jscomp.SourceFile

I would like to know:

  • When I omit the flag code compile fine, so am I passing correctly the flag?
  • Could you provide me more information about this error?

java -Xms256m -Xmx256m  -cp "%~dp0../shrinksafe/js.jar";"%~dp0../closureCompiler/compiler.jar --language_in=ECMASCRIPT5";"%~dp0../shrinksafe/shrinksafe.jar" org.mozilla.javascript.tools.shell.Main  "%~dp0../../dojo/dojo.js" baseUrl="%~dp0../../dojo" load=build %*

解决方案

As stated on the documentation:

(ClassNotFoundException) Thrown when an application tries to load in a class through its string name using:

  • The forName method in class Class.
  • The findSystemClass method in class ClassLoader .
  • The loadClass method in class ClassLoader.

What I think it's happening, due to the fact the code works when you omit the flag, is that the variable ECMASCRIPT5 is defined inside the compiler.jar, which you might not be including in the classpath.

You could try placing compiler.jar to your WEB-INF/lib in order for it to be deployed with your application and so on accessible when executed.

这篇关于抛出java.lang.ClassNotFoundException:com.google,javascript.jscomp.SourceFile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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