[英]Symfony2 assetic:dump | error Output: “The system cannot find the path specified”
I downloaded yuicompressor-2.4.8.jar and placed it in app/Resources/java/
folder. 我下载了yuicompressor-2.4.8.jar并将其放在
app/Resources/java/
文件夹中。
Next I created the {% stylesheets %}
block in my twig template as in example below: 接下来,我在树枝模板中创建了
{% stylesheets %}
块,如下例所示:
{% stylesheets
'bundles/arsen/css/style.css'
filter='cssrewrite, yui_css'
output='assets/css/complied.css'
%}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}">
{% endstylesheets %}
When I run app/console assetic:dump
, I get this error: 当我运行
app/console assetic:dump
,出现以下错误:
"/usr/bin/java" "-jar" "C:\xampp\htdocs\Symfony27\app/Resources/java/yuicompressor-2.4.8.jar" "--charset" "UTF-8" "-o" "C:\Users\SYMFONY\AppData\Local\Temp\ass2341.tmp" "--type" "css" "C:\Users\SYMFONY\AppData\Local\Temp\ass2340.tmp"
Error Output:
The system cannot find the path specified.
As far I know, I have java jre installed and I have access to java from command line: 据我所知,我已经安装了java jre,并且可以从命令行访问java:
$ java -version
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) Client VM (build 25.73-b02, mixed mode, sharing)
And in my windows path I have: C:\\ProgramData\\Oracle\\Java\\javapath registered This path points here: 在我的Windows路径中,我注册了:C:\\ ProgramData \\ Oracle \\ Java \\ javapath此路径指向此处:
Paths looks fine to me. 路径对我来说看起来不错。 Does anyone know what is missing or where is the issue preventing
app/console assetic:dump
command from working? 有谁知道缺少的内容或阻止
app/console assetic:dump
命令app/console assetic:dump
的问题在哪里?
Perhaps this setting causes the issue app/config/config.yml
: 也许此设置导致问题
app/config/config.yml
:
assetic:
#...
#java: /usr/bin/java
filters:
cssrewrite: ~
yui_css:
jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar"
#...
As stated by symfony documentation : 如symfony文档所述:
Windows users need to remember to update config to proper Java location.
Windows用户需要记住将配置更新到正确的Java位置。
In Windows7 x64 bit by default it's C:\\Program Files (x86)\\Java\\jre6\\bin\\java.exe.在Windows7 x64位中,默认情况下为C:\\ Program Files(x86)\\ Java \\ jre6 \\ bin \\ java.exe。
Actually, the command is looking for an executable located in /usr/bin/java
which doesn't exist on Windows. 实际上,该命令正在查找Windows上不存在的
/usr/bin/java
的可执行文件。
Also, you have to register your java path in your assetic configuration : 另外,您还必须在资产配置中注册Java路径:
assetic:
# ...
java: C:\Program Files (x86)\Java\jre7\bin\java.exe
See the YUI Compressor part of documentation. 请参阅文档的YUI Compressor部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.