在java程序代码中打开文件

class     TEST 
{  
    public  static  void  main(String[]  args){  
      System.out.println("Hello  World!");  
      try{  
            Runtime.getRuntime().exec("cmd  /c  start  D://A.xls");  
        }catch(IOException  e){}  
   }  

Runtime.getRuntime().exec("cmd  /c  start  d://a.xls")  

getRuntime()是取得系统运行时环境 
start参数表名直接启动excel文件,相当于双击操作 ,是个windows命令. 

引用博客:https://blog.csdn.net/aiwo429001/article/details/6406626

posted @ 2018-06-30 17:26  拾贝壳的人  阅读(664)  评论(0编辑  收藏  举报