如何使 yuicompressor jar 文件成为单例或全局可访问?
我想将 yuicompressor jar 文件放在一个文件夹中,以便我可以调用
< code>java -jar yuicompressor-2.4.2.jar ...
从我系统上的任何位置,使用 cygwin。对于我使用的 bash 文件,我只是将它们放在一个公共文件夹中,并将该文件夹的路径添加到我的 Windows 用户的 PATH 环境变量中,并且在 cygwin 中找到了 bash 命令。
当我 echo $PATH 时,我看到我将 yuicompressor jar 放入的文件夹列在 $PATH 中。
但是当我尝试 java -jar yuicompressor-xyzjar myfile.js -o myfile-min 时.js (例如)我收到以下错误消息:
无法访问 jar 文件 yuicompressor-2.4.2.jar
即使当我尝试提供 jarfile 的绝对路径时,我也会收到相同的错误消息。
我该怎么做?
I'd like to put the yuicompressor jar file in a single folder so that I can call
java -jar yuicompressor-2.4.2.jar ...
from anywhere on my system, with cygwin. For bash files I use I simply put them in a common folder, and added the folder's path to my windows user's PATH environment variable and the bash commands were found in cygwin.
when I echo $PATH
I see the folder I put the yuicompressor jar into listed in the $PATH..
But when I try java -jar yuicompressor-x.y.z.jar myfile.js -o myfile-min.js
(for example) I get the following error message:
Unable to access jarfile yuicompressor-2.4.2.jar
Even when I try providing an absolute path to the jarfile I get the same error message..
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PATH
环境变量是 shell 在尝试运行命令时将搜索的目录列表。java.exe
不会搜索PATH
环境变量上的目录来尝试找到您尝试运行的存档。因此,从包含存档的目录以外的任何目录运行 java -jar yuicompressor-2.4.2.jar 都将失败。提供绝对路径时您尝试的完整命令是什么?
The
PATH
environment variable is a list of directories the shell will search through in an attempt to run a command.java.exe
will not search the directories on thePATH
environment variable to try and locate the archive you are attempting to run. So runningjava -jar yuicompressor-2.4.2.jar
from any directory other than the one containing the archive would be expected to fail.What is the full command you are attempting when providing an absolute path?