如何关闭文件被打开的java.awt.Desktop [英] How close a file opened by java.awt.Desktop

查看:818
本文介绍了如何关闭文件被打开的java.awt.Desktop的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何关闭已打开的excel文件?

How to close an opened excel file?

打开Excel code是:

Open excel code is:

File file = new File("e:\\aaa.xlsx");
Desktop desktop = Desktop.getDesktop();
desktop.open(file);

什么是密切code?

What would be the close code?

只是用java打开和关闭Windows应用程序一样使用鼠标。

just using java open and close Windows application like use mouse.

推荐答案

算了。打开这里意味着注册的应用程序时,Excel,接管并打开一个窗口。之后,你无法控制,但在观看。 Excel将关闭。

Forget it. Open here means that the registered application, Excel, takes over and opens a Window. After that you have no control, but watching. Excel will close.

文件是重新presents文件系统路径的类。它本身不具有相关联的读/写器的状态。 Java 7的平行现在引入了更加进化的类路径。除了(显然)的文件系统,它也存储了什么文件系统路径。随着路径可以有多个文件系统,就像一个ZipFileSystem。这可以让你在一个zip复制和重命名文件。

File is a class that represents a file system path. Itself it has no state of associated reader/writer. Java 7 now parallel introduces a more evolved class Path. Besides (obviously) the path on the file system, it also stores what file system. With Path one can have more than one FileSystem, like a ZipFileSystem. That allows you to copy and rename files in a zip.

这只是一个阐述。

这篇关于如何关闭文件被打开的java.awt.Desktop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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