Results 1 to 5 of 5
  1. #1
    johslind is offline Member
    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Default javac's -d option

    Out of eg. MyApp.java in the directory C:\test I can create the MyApp.class by way of this order:
    Java Code:
    javac C:\test\MyApp.java
    It should be possible to let the javac create a subdirectory according to the file's package statement. So I have tried:
    Java Code:
    javac -d C:\test\MyApp.java
    That always gives me the message that javac could not create the directory.
    What am I doing wrong?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,535
    Blog Entries
    7
    Rep Power
    20

    Default Re: javac's -d option

    The -d option takes a directory (not a file!) and tells the compiler where to put the class file(s).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: javac's -d option

    (most) command line switches are documented here:

    javac - Java programming language compiler

    And just to complete the set, here are the ones for the java executable (again: most, not all. Some are a secret):

    java
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    johslind is offline Member
    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Default Re: javac's -d option

    Thanks, gimbal2. That helped me.

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: javac's -d option

    documentation always does.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. [Y/N] Option
    By OOO in forum New To Java
    Replies: 3
    Last Post: 03-24-2011, 10:49 PM
  2. JAX-WS\METRO - apt with option option key="r"
    By Talkinjive in forum Web Frameworks
    Replies: 0
    Last Post: 01-31-2010, 04:15 PM
  3. CVS with -f option
    By amiga23 in forum Eclipse
    Replies: 2
    Last Post: 09-22-2008, 02:57 AM
  4. Is JSP the right option?
    By Naga in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 08-20-2008, 06:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •