A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
how to get path of web application in tomcat?
Joined: Jan 08, 2004
Oct 04, 2004 01:36:00
hi, how do i get the path of web application folder in
? i want my system auto detect the current running web application folder , how do i code that ?
i have try
File f = new File("\\WEB-INF"); [B][I]what should i change from here?[/I][/B] System.out.println("path: " + f.getAbsolutePath());
which result me "path :c:\web-inf "
how do i make it to get c:\myrunningweb\web-inf ?
note: assume c:\myrunningweb is the current running web folder ..thank you !!
Joined: Aug 17, 2001
Oct 04, 2004 02:17:00
You can use the getServletContext().getRealPath("/") method...the you will get the real path till your context.
SOA & Java Book
It is sorta covered in the
JavaRanch Style Guide
subject: how to get path of web application in tomcat?
ant javac task not copying directory with no java files
using log4j in Tomcat
Hard to configurate Hibernate using NetBeans 5.5.1
Unable to run servlet
opening a File within my WEB-INF folder
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014