This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.