Hi All;
I have a problem of writing data in to a file in the tomcat server.
In that case i have tried with several ways to write but the only way which was successfull as follows.
static public final void WriteFile(String strFile, byte[] pData)
throws IOException {
String filePathe = "C:\\Documents and Settings\\Plateau\\WebRoot\\WEB-INF\\classes\\nsclient.properties";
BufferedOutputStream outStream = new BufferedOutputStream(
new FileOutputStream(filePathe), 32768);
if (pData.length > 0)
{
outStream.write(pData, 0, pData.length);
outStream.close();
}
But i want to get the relative path of the file with out giving the full path of it.For that i have tried with the following code to get file path.
String filePathe = URLDecoder.decode(ClassLoader.getSystemResource(
"test.txt").getPath(), "UTF-8");
But it works only if i run the code as java application(with out deploying and running inside the server)
Once i use this way to write file in the server it doesn't work.
What would be the problem?Any idea?
Thanks,
Thimali


