使用exe4j生成cmd界面的exe时,发现程序运行卡死,但是在idea里运行良好。经过排查发现是每次在写入excel时卡死,将写入语句从
wb.write(file)
改成
FileOutputStream fos = new FileOutputStream(file);
wb.write(fos);
fos.close();
即可
后来发现其实jar也是这种情况,这种读写如果不手动关闭的话,在idea里面可以运行,在cmd里会无限阻塞
使用exe4j生成cmd界面的exe时,发现程序运行卡死,但是在idea里运行良好。经过排查发现是每次在写入excel时卡死,将写入语句从
wb.write(file)
改成
FileOutputStream fos = new FileOutputStream(file);
wb.write(fos);
fos.close();
即可
后来发现其实jar也是这种情况,这种读写如果不手动关闭的话,在idea里面可以运行,在cmd里会无限阻塞