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
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.
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) {}
}