Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Accessing PATH Environment Variable

In Sun's 1.4 jre this is how its implemented;

public static String getenv(String name) {
	throw new Error("getenv no longer supported, use properties and -D
instead: " + name);
    }


> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
> Behalf Of Derek Morris
> Sent: Wednesday, February 07, 2007 2:01 PM
> To: CDT General developers list.
> Subject: Re: [cdt-dev] Accessing PATH Environment Variable
> 
> This may be a dumb question, but why can't you use System.getenv("PATH")?
> 
> --
> Derek
> 
> 
> Sanchali G. Kshirsagar wrote:
> >
> >
> > Hello Everybody,
> >
> >
> >
> > We have integrated our toolchain in MBS and we need the "PATH"
> > Environment Variable for referring the paths in Applicability
> > Calculators. Following is the code we are using to get the variable.
> >
> >
> >
> > IBuildEnvironmentVariable vars[] =
> >
> ManagedBuildManager.getEnvironmentVariableProvider().getVariables(configur
> ation,
> >
> >
> > *true*, *true*);
> >
> >                         *if*(vars != *null*){
> >
> >                                     String env[] = *new*
> > String[vars.length];
> >
> >                                     *for* (*int* i = 0; i < env.length;
> > i++) {
> >
> >                                                 *if*
> > (vars[i].getName().equalsIgnoreCase("path")) {
> >
> >                                                             String value
> > = vars[i].getValue();
> >
> >                                                             *if* (value
> > != *null*) {
> >
> >
> > toolChainEnvPath = vars[i].getValue();
> >
> >
> > *break*;
> >
> >                                                             }
> >
> >                                                 }
> >
> >                                     }
> >
> >                         }
> >
> >
> >
> > But we have observed that this code does not work on all machines. For
> > some PC's we do not get "PATH" variable in the above vars array. Could
> > anybody tell us is this the correct way to take the "PATH" variable or
> > is there any other method? We have also tried the configuration and
> > toolchain's Environment Variable provider, but with the same result.
> >
> >
> >
> > Regards,
> >
> > *Sanchali Kshirsagar*
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top