linux下不同用户下的java系统偏好设置 [英] java system preferences under different users in linux

查看:35
本文介绍了linux下不同用户下的java系统偏好设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在一个 linux 机器上的不同用户下运行多个 jvm(包括 tomcat).我没有看到太多问题,但在 catalina.out 中我一直看到这个:

I'm trying to run multiple jvms (including tomcat) under different users on one linux box. I'm not seeing too many issues, but in catalina.out I keep seeing this:

May 30, 2014 1:16:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 7626 ms
May 30, 2014 1:16:37 PM java.util.prefs.FileSystemPreferences$2 run
WARNING: Could not create system preferences directory. System preferences are unusable.
May 30, 2014 1:16:55 PM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock System prefs. Unix error code -158097957.
May 30, 2014 1:16:55 PM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

我做了一些挖掘/阅读并得出以下结论:

I did some digging/reading and deduced the following:

具有 root 访问权限的管理员必须创建具有 drwxr-xr-x 访问权限的系统首选项目录 /etc/.java/.systemPrefs.

An administrator with root access must create the system preferences directory /etc/.java/.systemPrefs with drwxr-xr-x access.

Java 正在寻找 /etc/.java/.systemPrefs/.system.lock/etc/.java/.systemPrefs/.systemRootModFile

Java's looking for /etc/.java/.systemPrefs/.system.lock and /etc/.java/.systemPrefs/.systemRootModFile

手动创建上述文件(使用touch"创建空文件)及其包含的目录应该修复.文件的权限应该是544,目录的权限应该是755,所有者和组都是root.

Manually creating the above files (use "touch" to create empty files) and their containing directories should fix. Rights to the files should be 544, rights to their directories should be 755, owner and group are root for all.

但是

我不是 root,让某人运行 root 很昂贵,而且我有多个用户在运行 jvms,这是否意味着我必须创建这些文件并设置权限,以便所有用户都可以访问这些权限?

I am not root, getting someone to run root is expensive and I have multiple users running jvms, does that mean i have to create those files and set up permissions just so that all users have access with those privileges?

有没有人遇到过这个问题,如果他们遇到了我缺少的更简单的解决方案?

Has anyone ever run into this issue and if they have is there a simpler solution i am missing?

推荐答案

为每个用户设置这些设置:

Set these settings per user:

mkdir -p ~/.java/.systemPrefs
mkdir ~/.java/.userPrefs
chmod -R 755 ~/.java
export JAVA_OPTS="-Djava.util.prefs.systemRoot=/home/user/.java -Djava.util.prefs.userRoot=/home/user/.java/.userPrefs"
  <run appl>

在不创建目录的情况下,某些 Java 虚拟机默认为 /etc/.

Without creating the directories, some Java virtual machines default to /etc/.

另见:Java - 设置首选项 backingstore 目录

这篇关于linux下不同用户下的java系统偏好设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆