Subject: how to get env variable values?
Posted By: suri Post Date: 8/6/2003 2:57:02 PM
Hi all

Can any one tell me how to get the environment variable in java from the unix box??

thanks in-advance
suri

Reply By: yasir_lahham Reply Date: 9/20/2003 5:34:28 PM
try this code, it should print the property name= value

import java.util.Enumeration;

public class Sys {

    public static void main(String[] args) {
    Enumeration enm=System.getProperties().keys();
    while (enm.hasMoreElements()){
      String prop=enm.nextElement().toString();
      System.out.println(prop.concat("= "+System.getProperties().getProperty(prop)));
    }
  }
}


MHD Yasir Al-lahham

Go to topic 1285

Return to index page 1042
Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035
Return to index page 1034
Return to index page 1033