javawindows-xpyui-compressor

Can't execute YUIcompressor globally using Path environments (Windows XP)!


I typed D:\yuicompressor-2.42\build in Path and save it (Windows XP). But when I tried executing it the command line displayed: unable to access jarfile. The same message that appear when I type an incorrect directory.

I tried executing the file in this way:

D:\wamp\www\projects\alexchen\alexchen 0.1\scripts>java -jar yuicompressor-2.4.2.jar custom.js -o custom.min.js

according to this

I tried calling the file directly and it works:

D:\wamp\www\projects\alexchen\alexchen 0.1\scripts>java -jar D:\yuicompressor-2.4.2\build\yuicompressor-2.4.2.jar custom.js -o custom.min.js

Solution

  • Probably you've misread the docs:

    It's simple to use, as shown in the following example. Replace /path/to with the actual path to the YUI Compressor, yuicompressor-2.4.2.jar with the actual version you are using, common.js with your input filename and common.min.js with the name you want the output file to be:

    java -jar /path/to/yuicompressor-2.4.2.jar common.js -o common.min.js

    This means that you should specify full path to your jar file, not to put it in the Path env variable.