dir command equivalent?

D

djbitchpimp

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
 
B

Benji

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top