Login  Register

properly sorted file list in java on Mac

Posted by Bill Mohler on Nov 21, 2007; 5:18pm
URL: http://imagej.273.s1.nabble.com/properly-sorted-file-list-in-java-on-Mac-tp3697924.html

This question is related to a plugin we use in ImageJ, but is more
directly related to Java on the Mac.

Our program calls up and acts upon a list of alphabetically ordered files
from a directory.  When run on Windows, it addresses these files in the
appropriate alphabetical order.  But on Mac, it does them in a somewhat
random order.  These are the exact same files from the exact same
directory on our server, in each case.

If we list the files in the directory through a Unix shell on the Mac,
using the -f option for unsorted list, we get the exact same "random"
order that our program accesses when running on the Mac.

The question, then, is what the proper Java code should be on the Mac so
that we get an alphabetically sorted list of files for our program to
access in order.  And why would the Java code for a file list work right
on Windows and not on Mac?

Thanks for any advice,
Bill