Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8001153

(prefs) user prefs not saved [macosx]

XMLWordPrintable

    • b01
    • Verified

      FULL PRODUCT VERSION :
      java version "1.7.0_10-ea"
      Java(TM) SE Runtime Environment (build 1.7.0_10-ea-b06)
      Java HotSpot(TM) 64-Bit Server VM (build 23.4-b01, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.7.4

      A DESCRIPTION OF THE PROBLEM :
      Java User Preferences no longer work with JDK 1.7.0_10-ea-b06 when run from the command line even though it works fine with the previous Oracle JDK 7 release (version 1.7.0_06) and Apple's JDK 1.6.0 releases. This problem only occurs when running java from the command line (e.g. in Terminal). If one runs the application by double clicking the jar file, preferences will load fine.

      When using the latest JDK 7 release and running from the command line, the following preference is empty even though the corresponding preference file has an entry and it works with previous JDK releases:
              Preferences prefs = Preferences.userNodeForPackage( MyClass.class );



      REGRESSION. Last worked in version 7

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Create a class and save preferences using:
              Preferences prefs = Preferences.userNodeForPackage( MyClass.class );
              prefs.put( "DEMO", "Success" );

      - Dump preferences using:
              Preferences prefs = Preferences.userNodeForPackage( MyClass.class );
              String result = prefs.get( "DEMO", null );
              System.out.println( "Current Preference: " + result );

      - Run the app using a previous version of the JDK to save the preferences and verify that the preferences are saved
      - Run the app using JDK 1.7.0_10 from the command line: java -jar app.jar




      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When writing the preferences it should display "Current Preference: Success"
      ACTUAL -
      "Current Preference: "

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Launch the jar by double clicking it in the Finder.

            khazra Kurchi Subhra Hazra
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: