aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Classpath+packages Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Classpath+packages" Watch "Classpath+packages" New topic
Author

Classpath+packages

Lucky J Verma
Ranch Hand

Joined: Apr 11, 2007
Posts: 277
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
Ranch Hand

Joined: Apr 11, 2007
Posts: 277
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Classpath+packages
 
Similar Threads
Classpath
Why does the class file compile in a different place
Compile error Package Does not Exit
Trouble compiling .class file - Tried Sun's solutions
package and classpath