What would be an equivalent way to print out the contents of the
current directory in Java? Also, how would I change the current
directory to list files in other directories?
Thanks,
-Greg
Benji - 04 Nov 2005 04:34 GMT
> What would be an equivalent way to print out the contents of the
> current directory in Java? Also, how would I change the current
> directory to list files in other directories?
Java is not a command shell. There is no (modifiable) concept of a
current directory. It's also not based on output.
The File class provides the capability that you would need. But you'll
have to provide the functionality of printing out and keeping track of
the current directory yourself.

Signature
Of making better designs there is no end,
and much refactoring wearies the body.
Madguy - 04 Nov 2005 05:11 GMT
Play with this.
http://java.sun.com/j2se/1.5.0/docs/api/index.html
It may give all nessasary stuff you need.
/Cheers,
-MadGuy
Roedy Green - 04 Nov 2005 06:37 GMT
>What would be an equivalent way to print out the contents of the
>current directory in Java? Also, how would I change the current
>directory to list files in other directories?
see http://mindprod.com/jgloss/file.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.