File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About package" Watch "About package" New topic

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[]){

SCJP 1.6
Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
javac -d <destinationDirectory> myPackage/

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:
subject: About package
It's not a secret anymore!