package is not created

hello people,

i am try to create a package using java program.

tha file is compiling .

class file is created

but it os stored in the same folder where i have stored the java file.

package is not created.

i am pasting my java code below

plz help me

thank u

package javaprog;

public class first

{

private String swa="chaithu";

private String swa1="schaithu";

private String n;

public String value()

{

n=swa+swa1;

return n;

}

public void setting(String a,String b)

{

swa=a;

swa1=b;

}

}

is there any modifications in the program or shall i dont any configural changes in the system.

thanks in advance.

[768 byte] By [chaithubtecha] at [2007-11-27 1:25:23]
# 1
You are compiling it from the wrong location.(Or what do you mean? The java file must be placed in the correct folder, and the class file will also be placed there by default)KajMessage was edited by: kajbj
kajbja at 2007-7-12 0:18:12 > top of Java-index,Java Essentials,Java Programming...
# 2

> but it os stored in the same folder where i have

> stored the java file.

yes, of course. what did you expect? That's what it's supposed to do, unless you tell it different.

did you mean, you expected it to move it to a different output folder? or did you mean you expected it to create a .jar archive for the package?

How exactly did you expect it to "create" the package?

guitar_man_Fa at 2007-7-12 0:18:12 > top of Java-index,Java Essentials,Java Programming...
# 3
@Op.You can take a look at the -d paramterer to javac.
kajbja at 2007-7-12 0:18:12 > top of Java-index,Java Essentials,Java Programming...
# 4
thats ok bossbut if u specify package javaprog;the package(folder) has to be created and the class file is supposed to created in that folder right !if notwhat is the nessicity of using package statement in the java programing.
chaithubtecha at 2007-7-12 0:18:12 > top of Java-index,Java Essentials,Java Programming...
# 5

> thats ok boss

> but if u specify

>

> package javaprog;

>

> the package(folder) has to be created and the class

> file is supposed to created in that folder

>

> right !

>

> if not

> what is the nessicity of using package statement in

> the java programing.

No, that's not quite right. The class file will always be put into the same directory it's source file is in, UNLESS you specify otherwise.

When the directory DOES matter is when you link it into an application (on the class path). Here, you specify the directory that the base package is in, and the classes must be in appropriate directories beneath that base directory in your classpath.

So javac does not actually generate the directory structure necessary for your packages to be linked into an application or a compile - it just puts the classes where the source files are. BUT, if you put your source files in the correct package directories before compiling, then when the class files are output, they will automatically be in the right places, by virtue of the fact that the source files were in the right places.

- Adam

guitar_man_Fa at 2007-7-12 0:18:12 > top of Java-index,Java Essentials,Java Programming...
# 6
i was not able to understand manfor exampleif u download uploadbean from javazoom.com website.at the time of compilation automatically the packages(directories) were created. i want to build the same feature in my program.how can i .thank u
chaithubtecha at 2007-7-12 0:18:12 > top of Java-index,Java Essentials,Java Programming...
# 7

> i was not able to understand man

> for example

>

> if u download uploadbean from javazoom.com website.

> at the time of compilation automatically the

> packages(directories) were created. i want to build

> the same feature in my program.

> how can i .

> thank u

Use the -d argument, just as I said before.

kajbja at 2007-7-12 0:18:12 > top of Java-index,Java Essentials,Java Programming...