problem with File.list() method

Moses DeJong dejong at
Sat Aug 28 03:30:41 PDT 1999

Hi all.

I have been running into some problems with the current CVS version of
Kaffe so I thought I would bounce what I have found so far off folks
on the list so that I might get some help.

Here is a example class that fails with the current CVS build
of Kaffe on my system (RedHat 5.2 Intel system with kernel 2.2.9).
The problem is with the File.list() method, it just returns null.


public class ListTest {
    public static void main(String[] argv) {
        File f = new File("/");
        if (! f.isDirectory()) {
            throw new RuntimeException("\"" + f + "\" is not a directory");

        String[] dirListing = f.list();

        if (dirListing == null) {
            throw new RuntimeException("dirListing is null");
        } else {
            System.out.println("dirListing files are as follows :");
            for (int i = 0; i < dirListing.length ; i++) {

JDK 1.1.7 from Blackdown

% java ListTest
dirListing files are as follows :

Kaffe from the CVS

% kaffe ListTest
java.lang.RuntimeException: dirListing is null

The problem seems to be in the
native implementation.

libraries/clib/io/File.c : Line 222

 * Get a directory listing.
HArrayOfObject* /* [Ljava.lang.String; */
java_io_File_list0(struct Hjava_io_File* this)
#if defined(DIR) /* Windows hack - XXX */
	char path[MAXPATHLEN];


	return (0);

The problem seems to be that this DIR symbol is not defined
and that means the code in the method never compiles.

The configure script seems to have found the definition for DIR.

checking for dirent.h that defines DIR... (cached) yes

More information about the kaffe mailing list