• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

JDK1.4 Could not lock System prefs

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My java program work fine in PC. Then, when I try to move it to Unix platform (JDK version: 1.4.0_02) and test the compatibility, it can work properly but shows following error message:
Jan 14, 2004 11:28:50 PM java.util.prefs.FileSystemPreferences$2 run
WARNING: Could not create system preferences directory. System preferences are unusable.
Jan 14, 2004 11:28:58 AM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock System prefs.Unix error code 2334152.
Jan 14, 2004 11:28:58 AM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
Jan 14, 2004 11:29:28 AM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock System prefs.Unix error code 2334152.
Jan 14, 2004 11:29:28 AM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
I have solved the problem by creating the missing directories and files under /etc:
Directory: /etc/.java/.systemPrefs
drwxr-xr-x 2 root other 512 Jan 14 12:26 .
drwxr-xr-x 3 root other 512 Jan 14 12:26 ..
-rw-r--r-- 1 root other 0 Jan 14 12:26 .system.lock
-rw-r--r-- 1 root other 0 Jan 14 12:26 .systemRootModFile
1. Can someone explain what purpose of above 2 files?
2. What APIs are they related to?
3. Should I document this in the installation note?
Thank you

David
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My question is why your code is trying to access System file properties anyway. I don't remember any requirements in the assignment asking for this feature.
What code is causing these errors? I'd probably remove them from your code.
The assignment is designed so you don't have to access OS files like that, so that you can simply move your application from one OS to another without any issues to deal with.
Mark
 
David Chan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a JDK bug!!!
I have tried to remove /etc/.java directory and run the test program.
import javax.swing.JFrame;

public class Test {
public static void main(String[] args) {
new JFrame().show();
}
}
It will appear the error message if run by JDK1.4, but when I change to use JDK1.3, that message does not appear again. Therefore, I am sure that there is no problem in my java code.
Since I use JDK1.4 to develop the program, I think it is better to add some information about this bug in the installation note because maybe not all graders know this bug.
For detail, refer this link:
Disable system preferences
David
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,
Perhaps you should upgrade to a later version of the JDK? I am using:

on my Linux machine, and I could not replicate your problem. I also tried leaving your application running for 60 seconds to allow the timer to expire, and adding the code to allow a clean exit (rather than a ctrl-c).
I ensured that I do not have an /etc/.java directory nor do I have a ~/.java directory.
Regards, Andrew
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
For what it's worth, I use


java version "1.4.2_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)


and I can't replicate the problem.
Regards,
jb
 
David Chan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have downloaded the latest JDK to compile the code, all OK. But I run the application, it failed. Please help.
When I type java -jar runme.jar, show the following error message:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/j2sdk1.4.2_03/jre/lib/sparc/motif12/libmawt.so
: ld.so.1: java: fatal: libXm.so.4: open failed: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1456)
at java.lang.Runtime.load0(Runtime.java:737)
at java.lang.System.load(System.java:811)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1477)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
at java.awt.Component.<clinit>(Component.java:506)
at suncertify.RunMe.main(RunMe.java:22)
I have checked the directory /opt/j2sdk1.4.2_03/jre/lib/sparc/, there only have motif21 directory but have no motif12 directory.
My solarix version:
SunOS labppsms 5.6 Generic_105181-28 sun4u sparc SUNW,Ultra-80
JDK version:
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

David
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic