Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javac creating .class files in source directory despite -d

843810Dec 21 2007 — edited Dec 21 2007
I'm having problems with compiling a package. Well, it compiles allright, the problem is more of an aesthetic matter, as well as a curiosity as to why this happens. My source files are in a package that resides under source directory src/. There is also a class directory classes/. From their mutual parent directory, I invoke the compiler with option -d classes. After compilation finishes, there is a new directory structure reflecting the package structure under classes/, and all my .class files are there. But they are also right next to the source files in the subdirectory of src/... why is that? Googling the matter gives me no clue, all I'm told is that -d causes javac to "only" write to the specified directory, but clearly that doesn't happen.

javac -version reports javac 1.6.0_03, and I have tried fiddling with classpaths:

javac -d classes src/.../packagename/*.java
javac -cp classes -d classes src/.../packagename/*.java
javac -cp src -d classes src/.../packagename/*.java

without any apparent effect.

Does anyone have any experience with this? What am I doing wrong?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2008
Added on Dec 21 2007
5 comments
288 views