Examine your Java properties:

// Code not compiled before posted, so typos are possible and unintentional
//
public class PropsServlet
    extends HttpServlet
{
    public void doGet(...)
    {
        // List all Java system properties to the browser
        //
        PrintWriter out = res.getWriter();
        System.getProperties().list(out);

        // Use "getProperties().getProperty()" to retrieve one by key
        //
        String javaClasspath =
System.getProperties().getProperty("java.class.path");
    }
}

You can use java.home or something similar to use as the "starting point" of
your relative path.

Ted Neward
Java Instructor, DevelopMentor ( http://www.develop.com )
http://www.javageeks.com/~tneward
-----Original Message-----
From: Kevin Yancy <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Sunday, March 12, 2000 6:32 AM
Subject: Servlet Local File Access


>Hi all,
>
>I wrote a class that will open a static HTML file and return
>the <BODY> portion in various formats. The idea is that a
>servlet could use this class to get all or a portion of it's
>content from static HTML files.
>
>This works, but only if I provide the full path on the local
>file system where the servlet resides. This of course won't
>get it. The static HTML files will always be in a
>subdirectory of where the servlet that accesses them resides
>(i.e. /myServletDir/contentDir).
>
>How can I determine where the servlet was actually loaded so
>that I can access the files in the "content" subdir by a
>relative pathname? Can I get this information from the class
>loader somehow?
>
>Apologize if this is a dumb question. I checked
>the SERVLET-INTEREST archives but couldn't find the answer
>there
>
>thanx in advance,
>Kevin
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to