Liam de Haas
Liam de Haas

Reputation: 1268

Open folder in root of project with Java Runtime

I want to open the folder bestellingen with windows explorer. the folder is in the root directory of my project. so far I have this:

        Runtime rs = Runtime.getRuntime();
        try {
            Process p = rs.exec("./bestellingen/");
        } catch (IOException exc) {
            exc.printStackTrace();
        }

But if I run the project the error says "acces denied"

Upvotes: 0

Views: 118

Answers (1)

Reimeus
Reimeus

Reputation: 159784

Directories can't be executed but you could do

File dir = new File("...");
if (Desktop.isDesktopSupported()) {
    Desktop.getDesktop().open(dir);
}

Upvotes: 2

Related Questions