You shoud try to put your property file in myapp/WEB-INF/classes directory
and use a statement like this
ResourceBundle bundle = ResourceBundle.getBundle("myprop.properties");----- Original Message ----- From: "Luong Phan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 21, 2003 12:07 PM Subject: Error when I load a file > Hi all, > > Thanks for your advices. The error is that files > startup.sh and shutdown.sh are not executable. Now I > can start Tomcat. > > But I meet the following problem: > - I use the mysql supported already by Redhat Linux > 7.3 O/S to store my database. > - The jakarta-tomcat-3.2.4 is used to be the server. > - I use mysql-connector-java-3.0.6-stable-bin.jar for > connection between mysql and JSP. > > - I put the my web application in the directory: > jakarta-tomcat-3.2.4/webapps/myapp. > - I put the mysql-connector-java-3.0.6-stable-bin.jar > in directories: jakarta-tomcat-3.2.4/lib, and > jakarta-tomcat-3.2.4/webapps/myapp/WEB-INF/lib > - I create a properties file (myprop.prop contains > DBURL, DBUserName, DBPassword, and DBDriver) and put > it at directories: jakarta-tomcat-3.2.4/bin, and > jakarta-tomcat-3.2.4/conf. > > After I start mysqlserver and tomcat, I type on the > Mozilla browse: http://localhost:8080/myapp, the > browser display my web page. When I link to a URL that > call the JSP program: > > > import java.io.FileInputStream; > import java.io.IOException; > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.ResultSet; > import java.sql.SQLException; > import java.sql.Statement; > import java.util.Enumeration; > import java.util.Properties; > > > public class MyData { > private Connection connection; > private Statement statement; > > > public MyData() throws > ClassNotFoundException,SQLException{ > > String DBDriver=null; > String url=null; > String username=null; > String password=null; > > Properties props = new Properties(); > String pFile="myprop.prop"; > try { > props.load(new > FileInputStream(pFile)); > } catch(IOException e) { > System.err.println("Failed to load > property file"); > } > ... > I get the following massage "Failed to load property > file". > > Please help me! > > Thank you very much. > > LuongPhan > > > > > --------------------------------- > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
