Microsoft KB Archive/191936

= BUG: file.list Doesn't Work with File("c:\\") on Win 95/98 =

Article ID: 191936

Article Last Modified on 8/25/2005

-

APPLIES TO

 Microsoft Java Virtual Machine, when used with:  Microsoft Windows 95

 Microsoft Windows 98 Standard Edition 

-



This article was previously published under Q191936



SYMPTOMS
Java's file.list method does not list files/directories on Windows 95 and Windows 98 with Virtual Machine for Java 2829 when file parameter is specified as File("C:\\") for example. This is true for any path ending with a "\\" specified as a parameter to File, irrespective of whether the program is an applet or an application.



RESOLUTION
The workaround is to append a period "." to the parameter as in File("C:\\.").



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce Behavior
<ol>  Create the following Java application Test.java: // Test.java

import java.io.*;

public class Test {  public static void main(String[] args) {                  File _file  = null;

_file = new File("c:\\"); String files[] = _file.list; for (int i=0; i<files.length;i++) System.out.println(files[i]); } }                       </li>  Generate a class file: <pre class="fixed_text">     jvc Test.java </li> Run the application:</li></ol>

<pre class="fixed_text">    jview Test

<div class="references_section">