I encountered a situation that was deployed to WebLogic and tomcat,
However, WebLogic cannot get the servletcontext,
Therefore, use the following method to obtain the data:
Thread. currentthread (). getcontextclassloader (). getresource (""). getpath ();
In this way, the paths obtained under the two servers are:
Tomcat get path:/WEB-INF/classes/
WebLogic: The corresponding domain root directory ..
When you use mkdir () to create a folder in the obtained path, Weblogic is created successfully and Tomcat is not created successfully!
Use mkdirs (), and both servers are created successfully.
The following is an explanation on the Internet,
Bytes -------------------------------------------------------------------------------------------------------
Boolean mkdir ()
Create the directory specified by this abstract path.
Boolean mkdirs ()
Create the directory specified by this abstract path name, including the parent directory that is required but does not exist.
PS: from Doc. It is recommended that you check the API.
Bytes -------------------------------------------------------------------------------------------------------
Bytes -------------------------------------------------------------------------------------------------------
The document is like tianshu! Let me explain the actual points:
Mkdir (): Only one directory can be created.
For example, file = new file ("C:/AA ");
File. mkdir (); // you can create an AA directory under C :/.
If there are multiple levels of directories, mkdir cannot be used to create: file = new file ("C:/AA/BB"); file. mkdir () // cannot be created.
It should be changed:
Mkdirs ():