Properties Test : Preference Properties « Development Class « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » Development Class » Preference PropertiesScreenshots 
Properties Test
Properties Test
   
/*
 * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * -Redistribution of source code must retain the above copyright notice, this
 *  list of conditions and the following disclaimer.
 *
 * -Redistribution in binary form must reproduce the above copyright notice,
 *  this list of conditions and the following disclaimer in the documentation
 *  and/or other materials provided with the distribution.
 *
 * Neither the name of Sun Microsystems, Inc. or the names of contributors may
 * be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * This software is provided "AS IS," without a warranty of any kind. ALL
 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
 * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
 * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN")
 * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
 * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
 * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
 * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * You acknowledge that this software is not designed, licensed or intended
 * for use in the design, construction, operation or maintenance of any
 * nuclear facility.
 */


import java.io.FileInputStream;
import java.util.Properties;

public class PropertiesTest {
  public static void main(String[] argsthrows Exception {
    // set up new properties object
    // from file "myProperties.txt"
    FileInputStream propFile = new FileInputStream("myProperties.txt");
    Properties p = new Properties(System.getProperties());
    p.load(propFile);

    // set the system properties
    System.setProperties(p);
    // display new properties
    System.getProperties().list(System.out);
  }
}

//file:myProperties.txt

/*
subliminal.message=Buy Java Now!


*/

           
         
    
    
  
Related examples in the same category
1. Put key value pair to PreferencePut key value pair to Preference
2. Get childrenNames from PreferencesGet childrenNames from Preferences
3. Get keys from PreferencesGet keys from Preferences
4. Get name and parent from PreferenceGet name and parent from Preference
5. Get node from PreferenceGet node from Preference
6. Get value from PreferencesGet value from Preferences
7. Export Preferences to XML fileExport Preferences to XML file
8. Passing references aroundPassing references around
9. Retrieve the preference node using a Class object and saves and retrieves a preference in the node.
10. Determining If a Preference Node Contains a Specific Key
11. Determining If a Preference Node Contains a Specific Value
12. Removing a Preference from a Preference Node
13. Getting and Setting Java Type Values in a Preference
14. Getting the Maximum Size of a Preference Key and Value
15. Getting the Roots of the Preference Trees
16. Retrieving a Preference Node
17. Removing a Preference Node
18. Determining If a Preference Node Exists
19. Retrieving the Parent and Child Nodes of a Preference Node
20. Exporting the Preferences in a Preference Node
21. Exporting the Preferences in a Subtree of Preference Nodes
22. Determining When a Preference Node Is Added or Removed
23. Read / write data in Windows registry
24. Listening for Changes to Preference Values in a Preference Node
25. Saving Data with the Preferences APISaving Data with the Preferences API
26. INI fileINI file
27. Preference Example:: export To FilePreference Example:: export To File
28. Properties load
29. Properties TreeMap and StreamProperties TreeMap and Stream
30. Parse Properties FilesParse Properties Files
31. Preferences DemoPreferences Demo
32. Sort Properties when saving
33. Loading configuration parameters from text file based properties
34. To read a Properties file via an Applet
35. A Properties file stored in a JAR can be loaded this way
36. Load a properties file in the startup directory
37. Have a multi-line value in a properties file
38. Convert a Properties list into a map.
39. Listing All System Properties
40. Getting and Setting Properties
41. Use XML with Properties
42. Store properties as XML file
43. Reading and Writing a Properties File
44. Read system property as an integer
45. Read a configuration file using java.util.Properties
46. Load properties from XML file
47. Here is an example of the contents of a properties file:
48. Use the Registry to store informations (Preferences API)
49. Load a properties file in the classpath
50. Listing the system properties
51. Properties Demo
52. PropsToXML takes a standard Java properties file, and converts it into an XML file
53. Utility class for preferences
54. Static methods for retrieving and system properties and converting them to various types
55. Store recent items (e.g. recent file in a menu or recent search text in a search dialog)
56. Storing/loading Preferences
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.