zoukankan      html  css  js  c++  java
  • Java 打开文件夹

     1 package com.swing.demo;
     2 
     3 import java.io.File;
     4 import java.io.IOException;
     5 
     6 public class OpenDirTest {
     7     public static void main(String[] args) {
     8         try {
     9             java.awt.Desktop.getDesktop().open(new File("D:\Java"));
    10         } catch (IOException e) {
    11             e.printStackTrace();
    12         }
    13     }
    14 }

    备用方式:

     1 try {
     2             String[] cmd = new String[5];
     3             cmd[0] = "cmd";
     4             cmd[1] = "/c";
     5             cmd[2] = "start";
     6             cmd[3] = " ";
     7             cmd[4] = FILE_PATH;
     8             Runtime.getRuntime().exec(cmd);
     9         } catch (IOException e) {
    10             e.printStackTrace();
    11         }
  • 相关阅读:
    Scrapy框架
    爬虫高性能相关
    存储库之MongoDB
    存储库之redis
    beautifulsoup
    pyecharts
    wxpy模块
    Gin框架
    Python的rabbitMQ
    Vue基础
  • 原文地址:https://www.cnblogs.com/freshier/p/4700696.html
Copyright © 2011-2022 走看看