File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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,,,,,,,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compile a class with the pachage statement