Results 1 to 3 of 3
  1. #1
    jitinsingla is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Default File.createTempFile() throws exception on Win7

    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
    Last edited by jitinsingla; 09-10-2010 at 04:04 PM. Reason: Additional information

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    when you run as a process as a service in windows, it used to be this would execute as the windows default internal service user account. This is not a real user account, at least it does not have access to some things, like network file shares, or local tcp sockets for COM connectors exposed by other applications.

    So I wonder if something is new with windows 7 that prevents the internal system user from having access to temporary files folder, some read only by default preference?

    The work around for me was to configure the tomcat service to "run as" a user account on my system. for example, my user, or the "Administrator" user, instead of the default internal windows system account. The only downside to this is when ever this user's password might change, you would have to update the service configuration to use the new password.

  3. #3
    jitinsingla is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

Similar Threads

  1. throws exception
    By simorgh in forum New To Java
    Replies: 1
    Last Post: 07-30-2010, 12:24 AM
  2. JButton: getLocationOnScreen() throws Exception
    By ExceptionHandler in forum AWT / Swing
    Replies: 10
    Last Post: 02-15-2010, 01:38 PM
  3. Exception throws when I read File
    By Juggler in forum New To Java
    Replies: 11
    Last Post: 08-18-2008, 06:09 PM
  4. Main method with throws Exception
    By bugger in forum New To Java
    Replies: 3
    Last Post: 01-07-2008, 02:48 PM
  5. throws Exception
    By javaplus in forum New To Java
    Replies: 1
    Last Post: 11-06-2007, 07:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •