4

When running java from the command line:

java -classpath bin:pellet-2.0.0/lib/* com.stuff.MyClass argumentTextStuff

I'm getting the following reply:

java: No match.

What's this mean? which java points to the expected file. And if I take the asterisk out, then I get the expected class not found error. Google searches aren't fruitful because I keep getting stuff about matching regexp patterns.

President James K. Polk
  • 40,516
  • 21
  • 95
  • 125
JnBrymn
  • 24,245
  • 28
  • 105
  • 147

4 Answers4

8

Ah... already figured it out. It worked when I was using a bash shell, however the * is treated differently in the tcsh shell. So we switched to bash and it works. The reason is described here (per polygenelubricants's suggestion in the comments below).

JnBrymn
  • 24,245
  • 28
  • 105
  • 147
  • 1
    See links like http://www.macosxhints.com/article.php?story=20020314095714397 (`set nonomatch`) ; http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ (Stupid parsing bugs) ; it's more than fine to answer your own question, but you should still do it in such a way to make it beneficial to the community as a whole. – polygenelubricants Jul 26 '10 at 15:17
  • agreed... I've been in the thick of things until this moment and couldn't post anything more helpful. – JnBrymn Jul 26 '10 at 19:24
3

That is a bash (or whatever shell are you using) error message not a java one.

It means that "bin:pellet-2.0.0/lib/*" doesn't match any file.

Do not use wildcards in classpath.

andcoz
  • 2,202
  • 15
  • 23
  • It was a tcsh shell error because tcsh treats the `*` symbol differently than bash. Actually, file globbing works as it should in bash and using the asterisk is greatly preferred over listing the twenty or so jar files that are represented by the asterisk. – JnBrymn Jul 28 '10 at 10:26
  • Ops, you are right :( I am so used to be the "only one" to use tcsh that I was sure you was using the bash. In any case, I do not agree that "globbing works as it should" in bash. I still prefer a shell that doesn't try to guess on which I want. – andcoz Jul 28 '10 at 14:23
1

If the * makes the difference, then the issue is probably related to how it's interpreted and by who. Try escaping it so that it's passed as is to java.

See also

polygenelubricants
  • 376,812
  • 128
  • 561
  • 623
0

With a unix Shell you often need to put such things in single or double quoted to ahold the Shell expanding the asterisk.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347