Windows 2008 服务上的 java 服务的 Tmp 问题

发布于 2024-08-27 11:53:17 字数 263 浏览 4 评论 0原文

我在使用 Windows 2008 服务器时遇到了一个相当严重的问题。我们有一个使用本地服务用户作为服务运行的 java 应用程序。问题是该用户无权读取/写入指定的 java tmp 目录(由系统指定)。这意味着每次应用程序尝试创建 tmp 文件时都会引发 IOException。

有没有办法让需要访问 tmp 目录的 java 应用程序作为服务运行,而无需:

  • 专门为此目的创建一个新用户
  • 指定一个新的 tmp 目录(您必须自己清理该目录)
  • 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)
  • 如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

    扫码二维码加入Web技术交流群

    发布评论

    需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

    评论(2

    紅太極 2024-09-03 11:53:17

    是否有原因无法授予“NT AUTHORITY\LocalService”帐户写入 Java 默认临时目录的权限?

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

    り繁华旳梦境 2024-09-03 11:53:17

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

    用于保存临时文件的目录位置由属性 java.io.tmpdir 定义。
    可以使用用于启动 JVM 的命令行更改默认值:

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

    或者,在 Windows 上,您可以将环境变量 TMP 设置为不同的值。

    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.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文