This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I am assuming that this is for windows. (since you referred to the c: drive)
You can't just execute a folder. Windows doesn't know what to do with it. I assume that you want to bring up a windows explorer -- set to the folder that you want. The command that you want is explorer.exe. And it should work if the first parameter is the folder name.
You can't just execute a folder. Windows doesn't know what to do with it. I assume that you want to bring up a windows explorer -- set to the folder that you want.
This isn't true. You can execute a folder. Go to your windows command line and type e.g. "start c:\windows" (without the quotes of course) and you'll see that it does exactly bring up a Windows Explorer set to that folder.
So if you call Runtime.exec() on "cmd /c start c:\\..." it should do what you want. But you'll have problems if your directory name has spaces in it. Typing "help start" at your command line should explain how to deal with that.
Why do you want to open the folder in Explorer? If the user selects a file from the folder, your program won't know anything about it. Are you trying to let the user select a file or folder that will be used in your program in some way? If so, you should use a file dialog of some kind. If you are writing a Swing application, you might be interested in JFileChooser. If you are using plain AWT, look at FileDialog instead.