on 06-30-2005 11:17 AM
Hello,
I have created a WebDynPro application. In this application i have created an XML file under
src->packages->resources. The resources folder i created myself.
I have also deployed the file on a remote server. This servername & portNumber can change too.
Now i want to get the handle of my XML file (which is present in the same jar) so that i can user it and populate it.
<b>The following code doesnt work:</b>
<i>File file =new File("WebDynProProjectName/resources/filename.xml");</i>
Regards,
Aayush
Hi all,
I too had the same issue.. Now could able to solve that.. Thanks to all of you..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am following the instructions for adding just a txt file to src\mimes\Components\<Component name>\file.txt and when i try to create a new File(file.txt) I get a FileNotFoundException. Why?
Thanks...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry what i meant was using FileReader(file.txt). this is what the actual code looks like. Nothing exciting just trying to get the file:
FileReader fr;
try
{
fr = new FileReader("deviceTypes.txt");
BufferedReader br = new BufferedReader(fr);
String type = br.readLine();
while(type != null)
{
type = br.readLine();
}
}
catch(FileNotFoundException fnfe)
{
}
this is what i get:
.\temp\webdynpro\web\local\xDemo\Components\xdemo.TestApp_WD\deviceTypes.txt
but, if i actually pass it the path it works though and when i just pass deviceTypes.txt it doesn't.
try
{
String path = WDURLGenerator.getResourcePath
(wdComponentAPI.getDeployableObjectPart(),
"deviceTypes.txt");
FileReader fr = new FileReader(path);
BufferedReader br = new BufferedReader(fr);
String type = br.readLine();
...
}
Have a look at the WDURLGenerator API.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aayush,
You can place your all required external files in src/mimes/components/<comp name>.
For this oopen the node src in webdynpro explorer and follow the above path. then right click on your component under this path and choose import files.
Then choose your XML file.
It will export this file in your component folder.
And now from your code you need not to give any explicit path or relative path to this file.
Only you need to give file name, thats it.
Let me know whether it qworks for you or not.
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aayush ,
1. Copy the file under Project/Src/Mimes/Components/<<ComponentName>>/Test.xml
2. Read the file using File file =new File("Test.xml");
This should solve the problem.
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
By default it puts it under resources folder. If you want to create your own path then
1. Create the XML file (eg. output.xml) to some location in the server (eg: c:\Test\files)
2. Create a HTTP alias(eg. Test) in the Visual Adminsitrator pointing to the file location (eg: c:\Test\files).
3. Set the linkToURL reference property to http://<<servername>>:50000/Test/<<XML file name>>
For creating the HTTP alias refer to the blog "Creating an HTTP Alias in WAS"
/people/renjith.andrews/blog/2005/03/31/creating-an-http-alias-in-was
Hope this solves your problem.
regards
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ravi,
Thanks. But this does not solves my problem :-(.
As of now i am just creating the project and building it in my development environment. I do not know about the runtime environment details as of now.
I can make it run only on 1 server using HTTP alias but i want to ensure that my utility (jar file) when deployed on any server uses the XML file packed with it.
Regards,
Aayush
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.