Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Method

Status
Not open for further replies.

ravioli

Programmer
Mar 30, 2004
39
US
Hi All,

I am using the following line of code:

String[] children = directory.list();

It seems fine when I used it other places but I am getting an error on compile:

C:\j2sdk1.4.2_11\bin>javac timeoutput.java
timeoutput.java:4: cannot resolve symbol
symbol : class io
location: package java
import java.io;
^
It seems to want me to import java.io . I have already done this however. The full code follows:

import java.io.*;
import java.lang.*;
import java.lang.String;

public class timeoutput {

public static void main (String[] args) {

String directory = "C:\\j2sdk1.4.2_11\\working";
long modifiedTime;
long t_difference;
long t_60_days_ago = System.currentTimeMillis()-5184000000L;

String[] children = directory.list();
//the rest of the code has been omited
}
}

Thanks for any help,
Bradley
 
the list() method belongs to the file class. You've defined directory as a string.

_________________
Bob Rashkin
 
Bong,

This worked fine to compile thanks.
The program is now doing what it should.

Bradley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top