简体   繁体   English

使用Java Runtime打开项目根目录中的文件夹

[英]Open folder in root of project with Java Runtime

I want to open the folder bestellingen with windows explorer. 我想用windows explorer打开文件夹bestellingen 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" 但如果我运行该项目,则错误显示“访问被拒绝”

Directories can't be executed but you could do 目录无法执行,但您可以执行

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM