如何使 yuicompressor jar 文件成为单例或全局可访问?

发布于 2024-08-31 01:08:56 字数 602 浏览 0 评论 0原文

我想将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月牙弯弯 2024-09-07 01:08:56

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 the PATH environment variable to try and locate the archive you are attempting to run. So running java -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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文