Java Classpath problem
I have a class in another package. I'm trying to access that class by writing classpath header in command prompt with directory structure.
My question is why I'm not getting compile time error, because I've not开发者_StackOverflow社区 specified any jar file which is necessary to compile that java source file, as command prompt classpath header will override environment CLASSPATH variable.
Maybe Java is picking up the classpath from your environment settings.
If you are on windows do a set
from the the command line and look for a CLASSPATH variable.
If you are on *nix do a env
| grep -i classpath.
By default Java will look in the local directory (aka java -classpath .
) but if the external classes are hidden away outside of your current directory then Java is probably picking them up from an environment variable.
精彩评论