• Post Reply Bookmark Topic Watch Topic
  • New Topic

File.createTempFile() throws exception on Win7  RSS feed

 
Jitin Singla
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i call File.createTempFile() on a Win7 system it throws the following exception. This happens when i run my application as a windows service. If i run the application just as a simple java application then it works fine.

java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Nati ve Method)
at java.io.File.checkAndCreate(Unknown Source)
at java.io.File.createTempFile(Unknown Source)
at java.io.File.createTempFile(Unknown Source)
at com.ultravisual.app.client.CmdLineContextAdapter.g etImageData(CmdLineContextAdapter.java:260)
at com.ultravisual.pcm.routing.RoutingService.runIter ation(RoutingService.java:357)
at com.ultravisual.pcm.routing.RoutingServiceWindowsR unner.run(RoutingServiceWindowsRunner.java:168)
at java.lang.Thread.run(Unknown Source)

Both System environment (TEMP, TMP) variables are set to C:\Windows\Temp.
Both User environment (TEMP, TMP) variables are set to %USERPROFILE%\AppData\Local\Temp.

Also i confirmed that both these directories exist on the workstation.

I would really appreciate if somebody could help me out with this problem
 
Rob Spoor
Sheriff
Posts: 20898
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which user account is the service running under? Local System? If so, keep in mind that there may not be a %USERPROFILE%. Try running the service under a different account.
 
Jitin Singla
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, i logged in as administrator and it worked.
 
Rob Spoor
Sheriff
Posts: 20898
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!