XML config with Java application
First of all, I would like to say hello to all...
This is my first post to the forum.
Through this post, I would like to ask for some guide to the problem that i am facing.
Recently, I was writing a JAVA application that can delete files after a certain time in computer.
Now, I am planning to storing the java application settings in XML .config file so that it can update certain application attributes without having to recompile the application.
For example, suppose you’ve developed an application to access a database on a SQL Server and you chose to hard-code the connection information in the application.
Now you want to move the database to a different server. Because the connection information is hard-coded in the application, you’ll have to modify, recompile, and redeploy the application to make this change.
But if you’re using a .config file, the change is as easy as modifying the ConnectionString key in the .config file.
Lastly, I hope someone who knows about this may kindly reply to this post.
many thanks in advance.
see the java.util.Properties class that is part of Java5. It supports XML files and you can use it to store your config data.
If it does not suit you - write your own XML file and parse it manually by using DOM or SAX - both available in JavaSE.
By (MC3)RaVeN in forum Java
Last Post: 04-03-2008, 04:17 AM
By Glen Kunene in forum Talk to the Editors
Last Post: 03-23-2002, 12:43 AM
By Brian Hoang in forum Java
Last Post: 01-26-2001, 04:17 AM
By Montclare Technologies in forum Java
Last Post: 09-20-2000, 02:58 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL