在java中打开windows资源管理器 [英] Open up windows explorer in java

查看:292
本文介绍了在java中打开windows资源管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Stack Overflow寻找一个答案,但是找不到对我有用的答案。

I have been looking for an answer to this on Stack Overflow, but I couldn't find an answer that worked for me.

使用Java,如何创建一个按钮,将启动资源管理器窗口到指定的目录?如果可以的话,我该如何使其在OSX和Linux上工作?

Using Java, how do I create a button that will launch an Explorer Window to a specified directory? If this is possible, how do I make it work for OSX and Linux?

推荐答案

我不知道它在其他操作系统,但在Windows中,您可以使用这样的东西

I am not sure how it works in other OS but in Windows you can use something like this

Desktop.getDesktop().open(new File("c:\\"));



编辑



找到其他方式(从该答案中检查链接到FileExplorer类)。还可以使用 System.getProperty(os.name)来确定操作系统。

Edit

Found another way (check link to FileExplorer class from that answer). Also you can use System.getProperty("os.name") to determine operation system.

这篇关于在java中打开windows资源管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆