如何在 Cygwin 环境中使 java keytool 尊重正斜杠?

发布于 2024-11-05 06:42:27 字数 438 浏览 7 评论 0原文

我正在使用 -v $HOME/.keystore 运行 Java keytool 程序,它在 Unix 中工作正常(创建 $HOME/.keystore),但在 Cygin 中感到困惑 - 说它正在存储

/home/myaccount/.keystore

但失败尝试写入

\home\myaccount.keystore

时出现 FileNotFoundException如何强制 keytool 使用正斜杠?

---->跟进:感谢下面的@micerobi回答了我的问题。 bash 使用它的一个小代码片段是:

keystore="$HOME/.keystore"
if [ `uname -o` == 'Cygwin' ]
then
    keystorefile=`cygpath -wp $keystore`
fi

I'm running the Java keytool program with -v $HOME/.keystore, which works fine in Unix (creates $HOME/.keystore), but in Cygin gets confused - says it is storing

/home/myaccount/.keystore

but fails with FileNotFoundException trying to write

\home\myaccount.keystore

How can I force keytool to use forward slashes?

----> Follow up: thanks to @mikerobi below who answered my question. A little code frag for bash to use this in would be:

keystore="$HOME/.keystore"
if [ `uname -o` == 'Cygwin' ]
then
    keystorefile=`cygpath -wp $keystore`
fi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

人生戏 2024-11-12 06:42:27

使用 cygpath 实用程序,该实用程序可以将任何 cygwin 路径转换为 ​​windows 路径。

keytool -v `cygpath -w "$HOME/.keystore"`

Use the cygpath utility, which can convert any cygwin path to a windows path.

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