Reading Evironment variable in context.xml

Posted on 2009-02-08
Last Modified: 2013-11-24
Hello everybody,

this is my first question here (but won't be my last).

I've put the path to a networkshare in an environment variable of my context.xml in a Java Web Project. The path contains an '$'-sign.

When I read this variable into my servlet the '$' is ommitted. I've tried to escape it, but this doesn't seem to help.

As a temporarily solution I've created a workaround by substituting the '$' by another symbol and then replace this in my servlet.

But can someone tell me what is going on here?

xml ==>

<Environment name="path_to_networtkshare" 


       type="java.lang.String" override="false"/>

servlet ==>

String folderPathIZ;

Context ctx = new InitialContext();

folderPathAZ = (String)ctx.lookup("java:comp/env/path_to_networtkshare");

Open in new window

Question by:De_Cisse
    LVL 13

    Expert Comment

    Did you try with unicode \u0024


    Author Comment

    Do I simply replace: value="\\\\servername\\c$\\Java\\path" with value="\\\\servername\\c\u0024\\Java\\path" ?

    In that case, this doesn't work.

    LVL 92

    Accepted Solution


    (I'm guessing)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now