How to access environment parameters from code

Hi,

I have set up a new environment parameter inside Implicit variables.

How do I access it from java code?

Regards,

Eric

Hi Eric,

First you have to import following,

import javax.naming.InitialContext;

then create a context object,

InitialContext context = new InitialContext();

then create a object and assign the environmental variable to that

Object result = context.lookup(“java:comp/env/” + “link”);

then convert to a string

String tempLink=result.toString();

Hope this will help

Regards,
Sunil_N

Here in this

Object result = context.lookup(“java:comp/env/” + “link”);

“link” is environmental variable name

Regards,
Sunil_N