JAVA application on a UNIX platform

I've stripped my code to the very simplest form and I can not fix this strange behaviour I'm getting when I run it on a UNIX machine. Both Linux and Windows work fine. Simply put this code initializes a File object corresponding to a directory on the user machine:

File dir =new File("/usr/local");

I then query the directory for all Files every couple seconds and print them out

while(x < 0){//infinite loop

list = dir.listFiles();

for (int y =0; y<=list.length-1; y++{

System.out.println(list[x].toString());

}

thread.slepp(1000);

}

The problem on the UNIX platform is that once the number of file reaches about 82, sometime 83, sometimes 84, it stops seeing all files. Comes up empty.This behaviour is not seen with Linux or Windows, I have listed up to 2500 files on those platforms. Any ideas?

BTW I'm using a SUN running Solaris

[1224 byte] By [zkaufman123] at [2007-9-30 17:43:35]
# 1

Well, is there any problem with your Solaris installation?

if you could run a script like this for a few minutes: (sorry, I have no access to a Solaris machine now in order to test this script, but I think that you can read it and understand the idea:

while true

do

ls -l /usr/local | wc -l

sleep 1

done

ls -l /usr/local lists the files of /usr/local, and wc -l counts the lines of the listing.

It's approximately the equivalent of your Java program. If it gives strange results like your Java program, you can try making a backup of all your work that you've done in the Solaris machine, and ask for immediate maintenance.

edsonw at 2007-7-6 14:12:33 > top of Java-index,Java Essentials,Java Programming...
# 2

By the way, what confusion you're making with the "x" and "y" variables?

Are you meaning this?

while(x < 0) {

//infinite loop

list = dir.listFiles();

for (int y =0; y<=list.length-1; y++{

System.out.println(list[y].toString());

}

try { thread.sleep(1000); } catch (InterruptedException ex) {}

}

edsonw at 2007-7-6 14:12:33 > top of Java-index,Java Essentials,Java Programming...
# 3
the 'ls' command works fine......it displays all 80, 90,100 (whatever) files. The java programs howevers stops displaying the files and says there is none there:
zkaufman123 at 2007-7-6 14:12:33 > top of Java-index,Java Essentials,Java Programming...
# 4
my real code did not actually confuse x and y. Just the post..sorry bout that
zkaufman123 at 2007-7-6 14:12:33 > top of Java-index,Java Essentials,Java Programming...