JDK 1.5 Live Code Examples

Discussion in 'Java' started by Mike, Jan 31, 2004.

  1. Mike

    Mike Guest

    Mike, Jan 31, 2004
    #1
    1. Advertising

  2. George W. Cherry, Feb 2, 2004
    #2
    1. Advertising

  3. Mike

    marcello Guest

    Java Runtime

    Hi my name is marcello,

    I have this problem,
    my application call a Runtime.exec() where the command is:

    On Linux

    "rm -f -r /usr/local/wa/etichette/etichetta0"

    On Windows :-(

    "del c:\\Programmi\\wa\\etichette\\etichetta0"

    On linux is ok but in windows catch an exception
    "can'Create a process"

    Thank you for your help :)
    marcello, Feb 5, 2004
    #3
  4. Re: Java Runtime

    In article <>,
    marcello <> wrote:

    >:Hi my name is marcello,
    >:
    >:I have this problem,
    >:my application call a Runtime.exec() where the command is:
    >:
    >:On Linux
    >:
    >:"rm -f -r /usr/local/wa/etichette/etichetta0"
    >:
    >:On Windows :-(
    >:
    >:"del c:\\Programmi\\wa\\etichette\\etichetta0"
    >:
    >:On linux is ok but in windows catch an exception
    >:"can'Create a process"
    >:
    >:Thank you for your help :)


    Interestingly enough, those two commands don't necessarily do the same
    thing, even if your Windows version worked.

    To fix that, you probably need to put "cmd /c" in front of the "del"
    command since you want the command shell to execute the del command.

    But the del command deletes a file. If that's a directory, it will
    error. The Linux command rm when used with the -r switch will
    recursively remove a directory and its contents. The -f switch
    suppresses any errors or warnings (and could be combined to "rm -rf").

    If in fact the item you're attempting to delete is a file and not a
    directory, why not simply do it internally in Java? Create a
    java.io.File object representing it and call its delete() method.

    = Steve =
    --
    Steve W. Jackson
    Montgomery, Alabama
    Steve W. Jackson, Feb 5, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Babar
    Replies:
    1
    Views:
    411
    Chris Smith
    May 20, 2004
  2. Thomas G. Marshall
    Replies:
    5
    Views:
    785
    Thomas G. Marshall
    Aug 6, 2004
  3. Ulf Meinhardt
    Replies:
    0
    Views:
    6,395
    Ulf Meinhardt
    Aug 10, 2006
  4. Jaggu
    Replies:
    3
    Views:
    964
    Nigel Wade
    Jan 8, 2007
  5. Pep

    JDK 1.5 or JDK 1.6

    Pep, Jul 11, 2007, in forum: Java
    Replies:
    19
    Views:
    1,702
    ~kurt
    Jul 15, 2007
Loading...

Share This Page