i have to write the code using simple java.i have to copy one source file to the destination file.the problem is that the user have to select the source and destination from any drives available.how to call the available drives in the java .no need of buttons
thank you.
i have to write the code using simple java.i have to copy one source
Share
java.io.Filehas astaticutility methodlistRoots()that returns aFile[]of available filesystem roots.From the documentation:
Here’s an example snippet:
This prints the absolute path and total space of each of the system’s filesystem root.
Related questions
Swing GUI component
If you are using Swing for GUI, there’s
javax.swing.JFileChooserwhich you may be able to use. It’s highly customizable (e.g. file extension filtering), and you can use it to select files and/or directories for saving and/or loading.See also
Related questions