This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using the '-d' flag

 
Marcus Deviln
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to put the .class files into a new folder I've made just for that purpose using the -d flag.

c:\Users\Marcus\My Documents>javac -d \bytecode
javac: directory not found: \bytecode
Usage: javac <options> <source files>
use -help for a list of possible options

c:\Users\Marcus\My Documents>javac -d ..\bytecode c:\Users\Marcus\My Documents\J
unk.java
javac: invalid flag: c:\Users\Marcus\My
Usage: javac <options> <source files>
use -help for a list of possible options

I tried a lot of other command possibilities besides these but none are working. What is it I am missing? I'm referring to chapter 10, page 792, Development of Kathy and Berts SCJP study guide
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-d is used to tell the compiler where to generate .class files. You still need to tell him which file you want to compile. For example, javac -d classes src/Hello.java

The second error is because you have spaces in your path. Use double-quotations to solve it :
javac -d ..\bytecode "c:\Users\Marcus\My Documents\Junk.java"
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the first command you tried was trying to put the class files into c:\bytecode, and while it's *possible* that's what you wanted, I'm skeptical.
 
Marcus Deviln
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah Ha!! Chris that worked. TOTALLY ROCKIN!! Thank you so much for your time
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic