wood burning stoves
The moose likes Beginning Java and the fly likes javac -d Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "javac -d" Watch "javac -d" New topic

javac -d

Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
I use this to compile a class but why do I not see the .class version being set into the appropriate directory? When I do this, I get no .class file. If I compile without the -d, the .class version will end up in the same directory as the .java version.
Ronald Schindler
Ranch Hand

Joined: Jul 11, 2000
Posts: 50
Into which directory are you trying to put the class file when compiling?
Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
It doesn't seem to make a difference. If I have a package com.test in the class and I try to compile with javac -d com\test cl.java it will say something like you can't compile into com\test\com\test. All I want to do is compile a class from the dos prompt and see it end up in the correct package/directory.
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
-d is going to be the "base" directory. Like, the same thing that you'd use in CLASSPATH.
So if you have a class called MyJunk in package "com.foo", and you want the thing to end up in /home/devel/classes/com/boo/MyJunk.class then you compile with javac -d /home/devel/classes MyJunk.java
and you'd execute it with
javac -classpath /home/devel/classes com.foo.MyJunk
I agree. Here's the link: http://aspose.com/file-tools
subject: javac -d
It's not a secret anymore!