• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about javac option -d.

 
Ranch Hand
Posts: 59
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
while compiling the java program in a package, i want to store the class file in to the file directory as the package name.
i know i can use -d option. but my doubt is that if i should manually create the directory or the javac -d command takes care of it.

thank you
 
Marshal
Posts: 8863
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

s sivaraman wrote:i know i can use -d option. but my doubt is that if i should manually create the directory or the javac -d command takes care of it.

Hi,

What have you discovered when you tried that?
 
s sivaraman
Ranch Hand
Posts: 59
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:

What have you discovered when you tried that?



thank you for your response.

i've a Fruit.java(D:\J\excercise) class in the package Food.

After i manually created Food folder in D:\J\excercise
i compiled using

D:\J\excercise> javac -d Food Fruit.java


it forms the .class file directory as D:\J\excercise\Food\Food\Fruit.class.

then i tried this,
i removed the Food from this D:\J\excercise\Food\
then i compiled like before, i got this

javac: file not found: Fruit.java
Usage: javac <options> <source files>
use -help for a list of possible options

 
Liutauras Vilda
Marshal
Posts: 8863
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Remove "Food" folder.
2. Be in that location "D:\J\excercise"
3. Execute "javac -d . Fruit.java"

See what happens then. Try to figure out, what "." means.
 
s sivaraman
Ranch Hand
Posts: 59
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Execute "javac -d . Fruit.java"


that works man..thank you...

See what happens then. Try to figure out, what "." means.


i figured it commands the system to create a folder as the package in the current working directory
and i also figured that

javac -d .\Food Fruit.java



it creates a Food folder above the already created Food folder.
 
s sivaraman
Ranch Hand
Posts: 59
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i almost got it man.
those are the proper ways for this kind of operation or still some other ways you have to do that?

i want to create the .class in different one from the currently working directory.

javac -d "C:\FFOutput" Fruit.java


i tried the above and its fine for me.
what do you think ?

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic