470,849 Members | 1,135 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Package and compiling

Isa
Hi!
I have a question about the package and Java class files. I hope someone can
answar me. When I compile a java source file with a package statement I
expect that the compiler should create the package directories and put the
class file there.
For example:

package homecompany.utilies;
public class graph{
....
}

The command C:\ javac graph.java compiles and create the class file
graph.class
in the same directory. I suppose that the class file graph.class should
placed in the
directory C:\homecompany\utilies\, but it does not. The development env. is
windows xp with Java SDK 1.4_2.

Thanks to any comment
Isa

Jul 17 '05 #1
3 5731


"Isa" <is**************@comhem.se> wrote in message
news:_U********************@newsc.telia.net...
Hi!
I have a question about the package and Java class files. I hope someone can answar me. When I compile a java source file with a package statement I
expect that the compiler should create the package directories and put the
class file there.


Wrong.
http://java.sun.com/docs/books/tutor.../packages.html
--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)
Jul 17 '05 #2
"Isa" <is**************@comhem.se> wrote in message news:<_U********************@newsc.telia.net>...
Hi!
I have a question about the package and Java class files. I hope someone can
answar me. When I compile a java source file with a package statement I
expect that the compiler should create the package directories and put the
class file there.
For example:

package homecompany.utilies;
public class graph{
...
}

The command C:\ javac graph.java compiles and create the class file
graph.class
in the same directory. I suppose that the class file graph.class should
placed in the
directory C:\homecompany\utilies\, but it does not. The development env. is
windows xp with Java SDK 1.4_2.

Thanks to any comment
Isa


Mapping between java package and system directory structure is
not automatic default. See Java Language Specification chapter 7.
Jul 17 '05 #3
Isa wrote:
Hi!
I have a question about the package and Java class files. I hope someone can
answar me. When I compile a java source file with a package statement I
expect that the compiler should create the package directories and put the
class file there.
For example:

package homecompany.utilies;
public class graph{
...
}

The command C:\ javac graph.java compiles and create the class file
graph.class
in the same directory. I suppose that the class file graph.class should
placed in the
directory C:\homecompany\utilies\, but it does not. The development env. is
windows xp with Java SDK 1.4_2.

Thanks to any comment
Isa


First, get the JDK documentation from Sun. Part of the documentation is
"Tool Documentation" and that will tell you lots of things about javac,
java, etc.

What you want is the -d option to javac.

Ray
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rui Pacheco | last post: by
1 post views Thread by news.verizon.net | last post: by
1 post views Thread by Andres Baravalle | last post: by
11 posts views Thread by Brett Romero | last post: by
1 post views Thread by Gheorghe Postelnicu | last post: by
3 posts views Thread by =?Utf-8?B?U3VzYW4=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.