如何在 Cygwin 环境中使 java keytool 尊重正斜杠?
我正在使用 -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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
cygpath
实用程序,该实用程序可以将任何 cygwin 路径转换为 windows 路径。Use the
cygpath
utility, which can convert any cygwin path to a windows path.