FileNotFoundException - Linux

Discussion in 'Java' started by Alexandr Molochnikov, Jul 28, 2003.

  1. I am stumped by the following strange problem:
    I start a GUI-based program from Eclipse; the program successfully reads
    some files from a directory. Then it launches another Java program, using
    Runtime.exec(). This second Java program tries to open the same (fully
    qualified) file, but throws FileNotFoundException.

    This happens in Java 1.4.1 under Red Hat Linux 9. The same program works
    fine under all flavors of Windows.

    It almost looks like the program launched through Runtime.exec(String cmd)
    does not know the environment it is in - although it is supposed to inherit
    it from the parent.

    Anybody faced similar problem?

    Thanks for any clues.

    Alex Molochnikov
    Gestalt Corporation
     
    Alexandr Molochnikov, Jul 28, 2003
    #1
    1. Advertising

  2. Alexandr Molochnikov

    iksrazal Guest

    "Alexandr Molochnikov" <> wrote in message news:<A81Va.20478$>...
    > I am stumped by the following strange problem:
    > I start a GUI-based program from Eclipse; the program successfully reads
    > some files from a directory. Then it launches another Java program, using
    > Runtime.exec(). This second Java program tries to open the same (fully
    > qualified) file, but throws FileNotFoundException.
    >
    > This happens in Java 1.4.1 under Red Hat Linux 9. The same program works
    > fine under all flavors of Windows.
    >
    > It almost looks like the program launched through Runtime.exec(String cmd)
    > does not know the environment it is in - although it is supposed to inherit
    > it from the parent.
    >
    > Anybody faced similar problem?
    >
    > Thanks for any clues.
    >
    > Alex Molochnikov
    > Gestalt Corporation


    I'm not sure if you mean two instances of eclipse, or eclipse and your
    program.

    Yet RH9 introduces a new kernel threading model, which can screw up
    pre-compiled binaries using less than 1.4.1_02 .

    Try setting this environment variable in your shell:

    export LD_ASSUME_KERNEL=2.2.5

    Its easy enough for a quick try.

    iksrazal
     
    iksrazal, Jul 28, 2003
    #2
    1. Advertising

  3. > I'm not sure if you mean two instances of eclipse, or eclipse and your
    > program.


    The first Java program is launched from Eclipse. It opens a number of files.
    Then this Java program launches another Java program using Runtime.exec().
    This second Java program tries to open the same files, and read the
    directory they are in - only to throw FileNoFoundException on every one of
    them.

    The Java version is 1.4.1_03.

    >
    > Yet RH9 introduces a new kernel threading model, which can screw up
    > pre-compiled binaries using less than 1.4.1_02 .
    >
    > Try setting this environment variable in your shell:
    >
    > export LD_ASSUME_KERNEL=2.2.5
    >
    > Its easy enough for a quick try.


    I do not use shell. Perhaps there is some way of setting it from Eclipse?

    >
    > iksrazal
     
    Alex Molochnikov, Jul 28, 2003
    #3
  4. Alexandr Molochnikov

    Roedy Green Guest

    On 28 Jul 2003 19:59:14 +0200, Gordon Beaton <> wrote or
    quoted :

    >Does the text in the FileNotFoundException exactly match the filenames
    >you were expecting? (fully qualified, you said)


    Some basic steps. Dump the name of the file in the secondary process
    surrounded in "" so you can tell if it has lead/trail spaces.

    Dump out all the System properties in the primary and secondary
    process. see http://mindprod.com/jgloss/wassup.html

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Jul 29, 2003
    #4
  5. I already reported the solution to my problem in the previous post. The
    double quotes that surrounded arguments in the command line (passed as a
    String to Runtime.exec()) were not stripped off under Linux when the
    arguments were read in by the launched process' main(). One of the
    parameters was a directory name and it was not recognized as such because of
    it. Under Windows everything worked because there the double quotes were
    stripped off before being passed to the spawned process.

    One of those underwater stones that make life interesting...


    "Roedy Green" <> wrote in message
    news:...
    > On 28 Jul 2003 19:59:14 +0200, Gordon Beaton <> wrote or
    > quoted :
    >
    > >Does the text in the FileNotFoundException exactly match the filenames
    > >you were expecting? (fully qualified, you said)

    >
    > Some basic steps. Dump the name of the file in the secondary process
    > surrounded in "" so you can tell if it has lead/trail spaces.
    >
    > Dump out all the System properties in the primary and secondary
    > process. see http://mindprod.com/jgloss/wassup.html
    >
    > --
    > Canadian Mind Products, Roedy Green.
    > Coaching, problem solving, economical contract programming.
    > See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Alexandr Molochnikov, Jul 30, 2003
    #5
    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. Brian
    Replies:
    1
    Views:
    3,279
    Rick Strahl [MVP]
    Dec 5, 2003
  2. Stephen Witter
    Replies:
    2
    Views:
    5,470
    Stephen Witter
    May 28, 2004
  3. msnews.microsoft.com

    System.IO.FileNotFoundException help

    msnews.microsoft.com, Jun 3, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,224
    msnews.microsoft.com
    Jun 3, 2004
  4. Martinh
    Replies:
    0
    Views:
    2,783
    Martinh
    Aug 15, 2004
  5. =?Utf-8?B?UmFqYQ==?=
    Replies:
    2
    Views:
    828
    bruce barker
    Sep 24, 2004
Loading...

Share This Page