serg472 / htmlcompressor

HTML Compressor and Minifier, can be used standalone and as a Java library
Apache License 2.0
40 stars 14 forks source link

Command line execution doesn't work, missing something? #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If I try to run htmlcompressor from command line I get:

java -jar htmlcompressor-0.9.2.jar

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/mozilla/javascript/ErrorReporter
        at com.googlecode.htmlcompressor.CmdLineCompressor.main(CmdLineCompressor.java:145)

Caused by: java.lang.ClassNotFoundException: 
org.mozilla.javascript.ErrorReporter
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more

Seems that it needs Rhino, I downloaded it and if I try running htmlcompressor 
again it happens the same:

java -classpath js.jar -jar htmlcompressor-0.9.2.jar

...leads to the same result

Original issue reported on code.google.com by dario...@gmail.com on 2 Sep 2010 at 4:20

GoogleCodeExporter commented 9 years ago
Fixed in 0.9.3. 

It always wanted YUI compressor jar to be present in the same library. Now it 
is rolled back to how it was before - yui compressor is needed only during 
javascript compression.

Thanks.

Original comment by serg472@gmail.com on 3 Sep 2010 at 5:12

GoogleCodeExporter commented 9 years ago
Agreed, then you should add a requirement notice in your project page, 
otherwise there is no way for people to know this, in fact I was thinking that 
the missing lib was Rhino.

Thanks.

Original comment by dario...@gmail.com on 3 Sep 2010 at 11:50

GoogleCodeExporter commented 9 years ago
It says that YUI lib is required when js or css compression is enabled (on the 
front page and in a command line help screen).

But I am reopening this bug and will add better error handling in the next 
version so when YUI lib is required it would say so instead of throwing an 
exception.

Thanks.

Original comment by serg472@gmail.com on 3 Sep 2010 at 3:23

GoogleCodeExporter commented 9 years ago
Thank you

Original comment by dario...@gmail.com on 3 Sep 2010 at 3:26

GoogleCodeExporter commented 9 years ago
Sorry if I continue to send msgs, but I tried starting htmlcompressor with:

java -classpath pathtoyui/yuicompressor.jar -jar htmlcompressor.jar

and I still get the same error. How do I use it from command line??

Original comment by dario...@gmail.com on 3 Sep 2010 at 3:45

GoogleCodeExporter commented 9 years ago
You don't need to set classpath, just put yui jar into the same folder as 
htmlcompressor.jar. Also it needs exact filename for yui jar, don't rename the 
file (if you download big archive with full compressor sources it has yui jar 
in it already which you can use).

This error should be gone if you use 0.9.3 version (unless you enable js or css 
compression, this would require yui jar)

Original comment by serg472@gmail.com on 3 Sep 2010 at 4:53

GoogleCodeExporter commented 9 years ago
0.9.4 has more clear message if YUI jar is missing.

Original comment by serg472@gmail.com on 13 Nov 2010 at 7:23