0

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 specified any jar file which is necessary to compile that java source file, as command prompt classpath header will override environment CLASSPATH variable.

5
  • 2
    I'm not sure what you mean with "command prompt classpath header". Please elaborate :) Commented Jan 28, 2010 at 19:57
  • javac -classpath . Something.java Here what I mean with "command prompt classpath header". Commented Jan 28, 2010 at 20:18
  • Can you show the code where you expect to get a compile-time error? Commented Jan 28, 2010 at 20:21
  • That's called "command line argument (of javac)" :) Commented Jan 28, 2010 at 20:30
  • Please edit the question to state a specific question. Commented Jan 28, 2010 at 20:36

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.