wood burning stoves 2.0*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 418
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