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 About package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About package" Watch "About package" New topic
Author

About package

Pradeep Kumar
Ranch Hand

Joined: Sep 11, 2007
Posts: 77
Hi, I want to know the command to compile a java file with package declaration which will automatically create a package folder and put the clas file into that folder. Can someone type the command for mw.

For ex:
package myPackage;

public class HelloWorld{
public static void main(String args[]){
System.out.println("HelloWorld");
}
}


SCJP 1.6
Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 417
javac -d <destinationDirectory> myPackage/HelloWorld.java

you can specify destinationDirectory as where you want your class files to go,and the directory will get created if it does not exists.

you can see more options about javac through command prompt also.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
This tutorial has some examples that may help.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About package
 
Similar Threads
cannot find symbol
Problem in compiling C file with JNI
Installation Problem-Help with running compiled code in command line.
please help import pakage how
[beans.xml] cannot be opened because it does not exist