classpath to access /read the text file from EAR onto the jsp.
Posted on 2006-11-03
I have a text file version.txt and it is present in the following location: EAR/xyzApp and this xyzApp has the version.txt file along with other jars.
I want to access/read the contents of this version.txt file into the jsp . I want to know what woud I access(the path) this text file onto my jsp which is present in a webapp inside a directory called WAR. WAR and EAR are in the same levels of hierarchy.
Here is the jsp scriplet I wrote:
<%@ page import=" java.io.*" %>
FileReader fr = new FileReader("/EAR/xyzApp/version.txt");
BufferedReader br = new BufferedReader(fr);
while ((buildVersion = br.readLine()) != null)
out.println("The buildVersion is --->"+ buildVersion);
catch (IOException e)
out.println("Uh oh, got an IOException error!");