views:

117

answers:

2

Hello!

I am having a rather nasty problem with windows 2008 server. We have a java application that is running as a service using the local services user. The problem is this user does not have access to read/write to the specified java tmp directory (specified by the system). This means that every time the application tries to create a tmp file an IOException is thrown.

Is there any way to make a java application that need access to the tmp directory run as a service without:

  • Creating a new user specifically for the purspose
  • Specifying a new tmp directory (which you will have to clean up yourself)
  • A: 

    Is there a reason you can't give the 'NT AUTHORITY\LocalService' account permissions to write to Java's default temp directory?

    ewall
    Even if this works, it seems like an annoying step for users that install your software. Is this problem java using an invalid java.io.tmpdir or an OS permissions problem on the tmp dir?
    jnorris
    @jnorris Indeed. There are specific restrictions when running as a service under Windows' LocalService account, including blocking of most outbound network calls... but it would be highly unusual if java.io.tmpdir were set to a network drive. So I agree, it's probably getting a bad value for it, and could/should be set directly on the command-line to be sure (as @crowne suggests).
    ewall
    A: 

    From http://www.rgagnon.com/javadetails/java-0484.html

    The location of the directory used to hold temporary files is defined by the property java.io.tmpdir.
    The default value can be changed with the command line used to launch the JVM :

    java -Djava.io.tmpdir=C:\mydir  myClass
    

    or , on Windows, you can set the environment variable TMP to a different value.

    crowne