A program HotKeyWrite.java (it pasted below) which uses java.util.prefs.Preferences and it creates directories and files under $HOME/.java/.userPrefs
In case $HOME directory set on local file system, attached program creates
directories and files properly.
But that directories and files are not created under $HOME/.java/.userPrefs
that NFS mounted directory with TurboLinux7 work station that kernel 2.4.5, glibc 2.2.3, gcc 2.95.3, nfs-utils-0.3.1-2.
This test is done with hopper-b15 and b16.
This program works fine with RedhatLinux7.1, 7.2 and TurboLinux8 though,
it creates directories and files under $HOME/.java/.userPrefs
that mounted on NFS.
Directory and file under $HOME/.java/.userPrefs should be created with
this program as follows.
$HOME/.java/.userPrefs/java
|-- awt
| |-- im
| |-- prefs.xml
| | `-- selectionKey
| | `-- prefs.xml
| `-- prefs.xml
`-- prefs.xml
HotKeyWrite.java start -------------------
import java.awt.event.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.prefs.Preferences;
public class HotKeyWrite {
/* Key names for java.util.prefs */
static final String nodePath = "/java/awt/im/selectionKey";
static final String keyCodeName = "keyCode";
static final String modifiersName = "modifiers";
/**
* Writes the selection key settings to the persistant storage
*/
static void writeSelectionKey() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
Preferences root = Preferences.userRoot();
Preferences node = root.node(nodePath);
node.putInt(keyCodeName, KeyEvent.VK_F4);
node.putInt(modifiersName, 0);
return null;
}
});
}
/**
* The main
*/
public static void main(String[] args) {
writeSelectionKey();
}
}
End -----------------------------
- duplicates
-
JDK-4673298 (prefs) Locking in Preferences sometimes fails on NFS mounted drives (Linux)
-
- Closed
-