How "java" knows the class file to execute without setting the class path.ie.,Does it check in the current directory by default or we need to set the class path for current directory too.
+3
A:
It checks the current directory first.
If class not found then it search for that class in class path.
More sophisticatedly
The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path
from doc
org.life.java
2010-09-14 06:57:44
is it correct .I read in some book like it wont check the current directory explicitly we need to set class path for current directory too...!~
JavaUser
2010-09-14 07:01:45
It's up to the vendor that writes the JVM. The standard implementation from Sun/Oracle looks in the current working directory first. Some oddball runtime could do it differently.
erickson
2010-09-14 07:03:15
edited the answer. check the doc
org.life.java
2010-09-14 07:05:42