Java classpath with and without colon ‘:’

I'm learning Java. I have a quirk that I think only experienced people can answer (I've completed the whole list of similar questions on so)

This is valid when compiled in eclipse and run from the command line

java -classpath : test.class

And this is not

java test.class

No directory specified

java -classpath bin test.class

But specified with the colon does

java -classpath bin: test.class

This is my understanding

>By default, Java checks the current working Directory > use colons only if you specify multiple paths

Solution

You want to run "java test" instead of "java test. Class"

Cheers!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>