|
It depends how you do it. The FileInputStream class will not use the classpath; it will use the directory you tell it to use. If you don't tell it (as in the example given), it will use the "current directory". It's obscure to me what that is, but I've seen it be C:\WinNT\System, which isn't where you want to be putting your properties files. You can use getServletContext().getRealPath("database.properties") to prepend a more useful path to your properties file name. In any case, you may want to write a test servlet that just displays things like current directory and the result of getRealPath() back to your browser so you get a feel for where it's looking for things. And you might want to have it output the result of System.getProperty("java.class.path") so you can see what your servlet engine's classpath is. PC2 -----Original Message----- From: Stone, Brad V (TC) [mailto:bvstone@taylorcorp.com] Sent: February 9, 2001 12:23 To: 'JAVA400-L@midrange.com' Subject: RE: Source Evaluation? Very cool! The only thing that still boggles my mind is what sets the default path where the program will look for these files? Is it one path, or is it the entire classpath? Brad > </snip> > > Properties prop = new Properties(); > prop.load(new FileInputStream("database.properties")); > +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.