在Java工程下,用java代码创建文件夹

日期:2021-08-09 01:07:43 人气:1

在Java工程下,用java代码创建文件夹

文件夹是创建了,但是肯定不在你的项目下面。
使用tomcat的servlet来获取项目路径并创建文件夹:但是这个文件夹不会再项目里面加载
String root = ServletActionContext.getServletContext().getRealPath("/upload");
File rootDirFile = new File(root);
if(!rootDirFile.exists()){
    A+
热门评论