Here is a suggested prefs install script which should be included into the install script. Please feel free to modify /improve it.
This script creates java.util.prefs system root directory and necessary
files - lock file and mod file.
echo "Is Java going to be used from a network mounted drive? [yes or no]"
read answer
if [ "$answer" = "yes" ]
then
PREFS_LOCATION=$JAVA_HOME
else
PREFS_LOCATION=/etc/.java
fi
echo $PREFS_LOCATION
if [ ! -d $PREFS_LOCATION ]
then
mkdir -m 755 $PREFS_LOCATION
fi
if [ ! -d $PREFS_LOCATION/.systemPrefs ]
then
mkdir -m 755 $PREFS_LOCATION/.systemPrefs
fi
touch $PREFS_LOCATION/.systemPrefs/.system.lock
touch $PREFS_LOCATION/.systemPrefs/.systemRootModFile
chmod 666 $PREFS_LOCATION/.systemPrefs/.systemRootModFile
chmod 666 $PREFS_LOCATION/.systemPrefs/.system.lock
The fix is to create the above mentioned files in /etc/.java with
1. pkgadd
2. if it's a root user installing with *.sh bundle with -localinstall option.
Otherwise they are always created in $JAVA_HOME, the directory where
JRE/JDK is extracted.