I am little confused when using package hierarchy in java files and their compilation. i just want to know what i have understood ,is it correct about javac.
When Javac compiles a .java file with some package statements, -> .java file is put into same directory structure as package ->javac forms .class into same directory structure automatically like if we change destination directory ->javac searches for reference classes(if any ) by prefixing with directory-structure as package hierarchy.
Lucky J Verma
Joined: Apr 11, 2007
one more doubt , we have two files Test2.java importing Test1.class in it. I read ,whenever we compile Test2.java ,it compiles Test1.java automatically. but we can use an alernative option by not mentioning classpath option on command line. javac classpath="." Test2.java //compiles Test1.java in same dir-structure.
but how about alternative, javac classpath="" Test2.java //gives an error,wont find Test1.class