• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Path to additional resources/xml file

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic