Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > FileNotFoundException - Linux

Reply
Thread Tools

FileNotFoundException - Linux

 
 
Alexandr Molochnikov
Guest
Posts: n/a
 
      07-28-2003
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


 
Reply With Quote
 
 
 
 
iksrazal
Guest
Posts: n/a
 
      07-28-2003
"Alexandr Molochnikov" <(E-Mail Removed)> wrote in message news:<A81Va.20478$(E-Mail Removed) >...
> 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
 
Reply With Quote
 
 
 
 
Alex Molochnikov
Guest
Posts: n/a
 
      07-28-2003
> 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


 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      07-29-2003
On 28 Jul 2003 19:59:14 +0200, Gordon Beaton <(E-Mail Removed)> 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.
 
Reply With Quote
 
Alexandr Molochnikov
Guest
Posts: n/a
 
      07-30-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 28 Jul 2003 19:59:14 +0200, Gordon Beaton <(E-Mail Removed)> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.FileNotFoundException, When Accessing file in remote ser =?Utf-8?B?UmFqYQ==?= ASP .Net 2 09-24-2004 05:34 PM
System.IO.FileNotFoundException: File or assembly name xlq0jgak.dll, or one of its dependencies, was not found. Martinh ASP .Net 0 08-15-2004 04:30 PM
System.IO.FileNotFoundException help msnews.microsoft.com ASP .Net 2 06-03-2004 03:45 AM
System.IO.FileNotFoundException using file.copy Stephen Witter ASP .Net 2 05-28-2004 08:20 PM
Loading a deployed Assembly - System.IO.FileNotFoundException Brian ASP .Net 1 12-05-2003 07:30 PM



Advertisments