File p = new File(pathname);
if (!(p.exists() && p.isDirectory()))
p.mkdirs();
PrintWriter pw = new PrintWriter(new FileOutputStream(pathname + Filename));
pw.println(getData());
pw.close();String getData(){
//从数据库读出文本,用循环生成一个String返回
}

解决方案 »

  1.   

    jdbc取数据,io输出文件,runtime运行文件
      

  2.   

    jdbc取数据,io输出文件,runtime运行文件
      

  3.   

    关于runtime能具体一点嘛?
      

  4.   

    import java.io.IOException;
    public class Runtime1 {
    public static void main(String[] args) {
    String path = "e:\\Project1.exe";
    try {
    Runtime.getRuntime().exec("cmd /c start " + path);
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
    }
      

  5.   

    那怎么把一张表导到word或excel里呢
      

  6.   

    servlet就可以。
    response.setContentType("application/vnd.ms-excel;charset=GB2312");
    //excel打开response.setContentType("application/msword;charset=GB2312");
    //word打开response.setContentType("application/ms-excel;charset=GB2312");
    response.setHeader("Content-disposition","attachment; filename=data.xls");
    //允许保存