This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Compile a class with the pachage statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compile a class with the pachage statement" Watch "Compile a class with the pachage statement" New topic
Author

Compile a class with the pachage statement

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hello,
Could you please tell, how to compile a class with a package statement. I mean the class should go to the perticular directory.
Thanks


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
From the javac documentation note that the -d option specifies that compiled classes are to be placed in the directory specified after the -d switch. Also note it says that "[i]f a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed."
Another thing to note is that if you're working from a command prompt and you'd like the package directories to be created in the current working directory, the easy thing to do is to just use a period "." following the -d switch. The period specifies that the current working directory is to be used.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Ok thank you very much,,,,,,,
 
 
subject: Compile a class with the pachage statement
 
Similar Threads
Importing packages: error again
Help on Packages!!
questions about several File methods.
constructor and subclasses
Serialization Doubt