Java 7命令行在Windows上的通配符扩展(7?) [英] Broken wildcard expansion for Java7 commandline on Windows(7?)

查看:191
本文介绍了Java 7命令行在Windows上的通配符扩展(7?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



对于几个世纪来说,*和*之间有一个完全不同的区别。

似乎这不是Java7的(至少在Windows7上)。



我注意到使用通配符类路径

尽管引用了wildcard-classpath,它也被扩展了。

因此,似乎不可能再将通配符传递给java应用程序。



因此,使用 java -cp某处/ *将失败(somewhere \ *)。



一种解决方法似乎是: java -cp某处/ *;这会阻止扩展。



为了验证我写了一个小的Echo.java类的行为。



我发现使用java 1.6.0引用*和纯*工作像预期,
而在Java7我总是有扩展的通配符。
直到现在,这是在Windows7上观察到的,不知道在XP上会发生什么。



问题出现了,因为Windows上的通配符永远不会扩展age像CMD.EXE(像任何shell在UNIX上)。相反,每个可执行文件必须使用 setargv.obj 明确执行此操作。



我发现了两个似乎描述类似问题的相关问题:





这是由别人观察到的吗?

或者有一些模糊的Windows或批处理文件设置来控制吗?



Dieter。

解决方案

是的,我注意到同样的问题。




I observe a strange behavior of wildcard expansion behavior for Java7 on Windows.

For centuries there was a clean difference between "*" versus *.
Seems this it not longer true for Java7 (at least on Windows7).

I noticed the problem when using a wildcard classpath.
In despite of quoting the wildcard-classpath it gets expanded.
Thus it seems not possible any more to pass a wildcard to the java application.

So using java -cp "somewhere/*" will fail (as does "somewhere\*").

A workaround seems to be: java -cp "somewhere/*;" which inhibits the expansion.

To verify the behavior I wrote a small Echo.java class.

I found that using java 1.6.0 quoted "*" and plain * works like expected, whereas on Java7 I always got the expanded wildcard. Until now this was observed on Windows7, don't know what happens on XP.

The problem arises, since wildcards on Windows are never ever expanded by dark age CMD.EXE (like any shell does on UNIX). Instead each executable has to perform this explicitly using setargv.obj.

I found two related issues which seem to describe a similar problem:

Is this observed by someone else?
Or are there some obscure Windows or batch-file settings to control this?

Dieter.

解决方案

Yes, I noticed the same issue.

  • It's explained as a 'known issue' in the release notes for Java7 update 4.

  • Here is the bug report. The fix will be delivered in Java7 update 8 (current release is update 6).

  • Note that there isn't a shell-options workaround, because in Windows, the shell doesn't handle wildcard expansion. (Whereas in Unixes, the shell performs the expansion).

这篇关于Java 7命令行在Windows上的通配符扩展(7?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆