473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

where can I find my servlet ? :)

I have Tomcat running a servlet that needs to know the location of the
WebApp that contains it (actually it needs to know the full path to
itself). I thought that the servlet path was relative to the Tomcat
bin directory (since tomcat si actually running this service). I did a
simple test and found out that tomcat is actually running from
c:\WINDOWS\system32 ... so that's the path that the servlet is
relative to.

Now, normally, that wouldn't bother me much but I really need to know
the path to my servlet (in some sort of multi-platfrom way - since
this revlet is going to be run on a linux server - that dosen't have
any C:\WINDOWS\system32 :D ).
Jul 17 '05 #1
1 1822

"Silviu-Lucian" <lu****@nortex.ro> wrote in message
news:78**************************@posting.google.c om...
I have Tomcat running a servlet that needs to know the location of the
WebApp that contains it (actually it needs to know the full path to
itself). I thought that the servlet path was relative to the Tomcat
bin directory (since tomcat si actually running this service). I did a
simple test and found out that tomcat is actually running from
c:\WINDOWS\system32 ... so that's the path that the servlet is
relative to.

Now, normally, that wouldn't bother me much but I really need to know
the path to my servlet (in some sort of multi-platfrom way - since
this revlet is going to be run on a linux server - that dosen't have
any C:\WINDOWS\system32 :D ).


I assume since you're using a servlet you'll have access to the
ServletContext. I think you'll find something useful in these methods:

getRealPath()
getResourceAsStream()
getResourcePaths()

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ron Brennan | last post by:
This is from an application and not an Applet. I believe it goes to stdout but when I do a test and write an abitrary string and then do a search of the hard disk for the string, I can't find...
1
by: Cedric | last post by:
Hello, I'm developping my first Struts application. I've got this error: Cannot find message resources under key org.apache.struts.action.MESSAGE web.xml <servlet>...
1
Nepomuk
by: Nepomuk | last post by:
Hi! I'm working on a project using tomcat and spring. Now I have written a Bean class, which reads an XML-File via Springs XmlBeanFactory, creates a Vector from the collected Information and then...
14
by: ramadeviirrigireddy | last post by:
Hi All, I have the following code for form and servlet. when the form is submitted the servlet will print the values passed by the form. i'm not getting the servlet o/p when i submit the...
4
by: shaileshkumar | last post by:
hi, when i type javap javax.servlet.Servlet on the command propmpt iam gettting the following error Error:could not find javax.servlet.Servlet plz help me proper instructions to make...
3
raveendrabikkina
by: raveendrabikkina | last post by:
3087 / 3126 02/25 10:42:08 info Recovering 1 session(s) 3088 / 3126 02/25 10:42:08 warning Deployer Service failed to deploy file:/opt/jrun4/servers/cpbepost/logs/ 3089 / 3126...
5
by: creative1 | last post by:
hi, I am new at writing JSP and Servlets. When I compile my serverlet I get follwoing error cannot find mymbol method parseDate(java.lang.String) I have follwoing code: Code: ( text )...
6
oll3i
by: oll3i | last post by:
when i run my jsp file i get an error SEVERE: Servlet.service() for servlet jsp threw exception java.util.MissingResourceException: Can't find bundle for base name MessagesBundle, locale pl_PL...
9
by: mjahabarsadiq | last post by:
Hi I have created a servlet that is to be started at the server startup. And I got it. In that I have created a object of another class and set it as a session attribute. What I am trying is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.