I have a xml file located in D:\\XML\\RequestXML
and I am reading xml file in this folder from a FileReader
. In my program I hard coded the file pa
First a bit of bad news: FileReader is a utility class that as default uses the platform encoding: non-portable. As the encoding is defined in the XML source itself, you might keep to InputStream if possible.
You could keep the XML as read-only resource inside the war/ear.
Or as read-only resource in the jboss directories, outside the application. Using as java resource via the system ClassLoader of jboss.
Or as file, where the path is configured as above. Maybe in an existing properties/xml configuration file. You could also use the jboss admin console to configure a path.
Maybe of interest:
System.getProperty("file.encoding"); // The default encoding
System.getProperty("user.name"); // Under which user are we running
System.getProperty("user.home"); // The user's home
System.getProperty("user.dir"); // The applications working dir
JBoss also defines a couple of things; but that would be non-portable.