yui / yuicompressor

YUI Compressor
http://yui.github.com/yuicompressor/
Other
3.01k stars 664 forks source link

FileNotFoundException on Windows #167

Closed leperse closed 9 years ago

leperse commented 10 years ago

Had to use the the 2.4.7 version instead.

java: "C:/Program Files (x86)/Java/jre7/bin/java.exe" filters: yui_css:

2.4.8 fail on windows

    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
tml commented 10 years ago

Can you explain more about what exactly is failing?

iignatov commented 10 years ago

I have the same problem with 2.4.8, while 2.4.7 works fine.

Command line:

java -jar ".\tools\yuicompressor.jar" "D:/Websites/test/Scripts/main.tmp.js" -o "D:/Websites/test/Scripts/main.min.js" --charset utf-8

Exception info:

java.io.FileNotFoundException: \Websites\test\Scripts\main.min.js:\Websites\test\Scripts\main.tmp.js (The filename, directory name, or volume label syntax is incorrect)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)

I tried with both forward slashes and backslashes in the file paths. I also verified that the file main.tmp.js exists (main.min.js does not). The error when using forward slashes in the path is almost the same, with exception of the first line:

java.io.FileNotFoundException: WebsitestestScriptsmain.min.js:\Websites\test\Scripts\main.tmp.js

OS/JRE information:

Windows 7 Professional Service Pack 1 (64-bit)

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

%JAVA_HOME% = C:\Program Files\Java\jre\
Hofferic commented 9 years ago

Same here, my build script fails with 2.4.8. If I just revert to 2.4.7everything runs fine. Command line:

java -jar yuicompressor-2.4.7.jar C:\Users\Eric\AppData\Local\Temp\tmpfg1s1w4c --type css -v -o C:\Users\Eric\AppData\Local\Temp\tmpnwe0o6ie --charset utf-8 -v

Exception:

java.io.FileNotFoundException: UsersEricAppDataLocalTemptmpnwe0o6ie:\Users\Eric\AppData\Local\Temp\tmpfg1s1w4c (Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:208)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)

(The german error description boils down to a syntax error for the filename or descriptor)

OS/JRE:

Windows 8.1 Pro (64-bit)

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

Looking at the first line of the exceptions both @iignatov and I posted it seems to me that something goes wrong in the parsing of the input output filename, leading to it being mashed together with the output input filename in Place of the drive letter on Windows.

FINAL EDIT: I just looked at the files from the stack trace and found a commit supposedly fixing this bug, so until the next release comes around windows user will have to stick with 2.4.7 or compile the compressor from source!

tml commented 9 years ago

If one of you who is able to reproduce the problem could compile it from source and let me know whether it fixes the problem, it'd be appreciated.

Hofferic commented 9 years ago

I compiled from source at yui/yuicompressor@47773cd409686715644b95503f95fbe6b52fc84f and it works without a hitch on Win8.1x64. For those who face the same problem and are too lazy to clone and compile it themselves I put the .jar on dropbox (with no guarantee for how long it will be on there ;)

https://dl.dropboxusercontent.com/u/93394/yuicompressor-2.4.8.jar

mwikblom commented 9 years ago

We have the same issue. Thanks @Hofferic for the patch!

tml commented 9 years ago

Indeed, @Hofferic - thank you for hosting that. With a second user confirming the fix, I'll mark the issue as closed, and it will be part of my next release.

ghost commented 8 years ago

@Hofferic Thank you for the file! Works llike a charme in my Symfony app

dec commented 8 years ago

I also experiment this same issue here in Windows 10 Pro. Many thanks for your considerations @Hofferic, your JAR works like a charm!