• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Path to additional resources/xml file

 
Peter Jansen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I've recently installed NetBeans and I'm having trouble with path information. NetBeans 5.5 RC2 installed a completely new version of Tomcat 5.5 on my local Windows system. Almost everything works fine. The default directory for my Project class files is "My Documents/ProjectName"

That's fine. But when I try to access an XML File from one of my servlets, netbeans-tomcat will look for it under netbeans-5.5rc2/enterprise3/apache-tomcat-5.5.17/bin and this is even on a whole different hard drive.

Of course I would prefer to have everything under one roof whithout using absolute paths. Where do I define my path for external files? It all worked fine before I used Netbeans, but then I had a different Tomcat 5.5 installation. As I said, Netbeans installs its own Tomcat version without even asking.

The funny thing is, when I access an image file from my jsp it will look in the same file system where the JSP is, but when I use the same JSP or a servlet to load my XML it will look for it elsewhere. Here is just a simple snippet of code to illustrate:



I tried to change some settings in Tomcat's configuration files, but it just didn't work.

Thanks for your help!!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That usage of File with the file name only just looks in the "current" directory, something you have no control over. You must use one of the versions of File that takes a path and provide for telling the application what the default path for this xml file is.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic