David
David

Reputation: 14963

Why can't I create a folder in %CATALINA_TMPDIR%?

This is the weirdest thing ever. I'm working on an app that I run using Tomcat though IntelliJ IDE. Part of this app creates a folder in the configured %CATALINA_TMPDIR%. For some reason no matter where I point %CATALINA_TMPDIR% to java can't create a folder there, but it can create a folder everywhere else.

For example, If CATALINA_TMPDIR=C:\Users\dallend\.IntelliJIdea14\system\tomcat\Unnamed_datasite_7\temp then my app can't create a folder there, but can create it in C:\Temp, a folder I created.

Then if I change to CATALINA_TMPDIR=C:\Temp, the app won't be able to create a directory there but will be able to create one at C:\SomewhereElse.

From debugging through things it appears that java.io.File tries to create the directory but that the WinNTFileSystem.public native boolean createDirectory() method can't successfully create it.

Why might this happen? Could there be something I need to tweak with IntelliJ, or Java, or my OS? Has anyone encountered this before?

EDIT: I've tried running Tomcat stand-alone, and the problem persists.

Upvotes: 2

Views: 476

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48077

Try to use forward slashes in your directory names. I've pulled out a lot of hair with backslashes actually escaping a path, e.g. C:\temp pointing to C:<tab>emp. I've completely given up on using backslashes even on Windows: Java will translate forward slashes just fine: C:/temp/

Upvotes: 1

Related Questions