Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within I/O and Streams
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
I/O and Streams
i want to remove the hard coding
dhanunjaya kumar
Greenhorn
Posts: 16
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i am reading data from a file using
jsp
.
FileInputStream fin=new FileInputStream("c:/program files/tomcat/project/book1.txt");
i want to remove this path "C:/......." and i want to use relative path like "/book1.txt" it was not working.
Even i went for java.io.File.getPath();but i did not succeeded
i am getting the path upto "c:/program files/tomcat/bin"
can any one help on this
Jean-Francois Briere
Ranch Hand
Posts: 101
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In your JSP page try something like:
FileInputStream fin = new FileInputStream(application.getRealPath("/book1.txt"));
Regards
Willie Smits can speak 40 languages. This tiny ad can speak only one:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
setting tomcat5.5 server in eclipse
Urgent question
Error access denied
CATALINA_HOME directory location question
need help reading a properties file
More...