Search This Blog

Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

Friday, September 11, 2015

Read properties File from a WAR module running on Eclipse

I came across a problem where I was able to read property file for a Java project but when it was being deployed to tomcat as a war it was giving problem.

 
The code that worked is pasted below

 
  1. Create a src folder and name it resources
  2. Put the property file there.
  3. In the code access it like this

 

 
 InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("db.txt");




If you are making it for a DBconnection class which you are using for DAO in your code. The DBconnection  class will be static.

Tuesday, October 28, 2014

Tom cat 7 giving error , no JRE_HOME found

Open

Try to set environment variable JRE_HOME= location of jre

if it fails again with same message

Open up setclass path bat inside /bin and go the place where its check JRE_HOME
set the jre home there and open a command window.

before running startup.bat , run the command setclasspath.bat

After that Tom cat books up.

End