1 Reply Latest reply: Feb 3, 2004 1:45 PM by 807582 RSS

    java.lang.IllegalArgumentException: Null charset name

    807582
      Hi,

      I'm trying to read the Property file in path and then set them in System properties so that it will be accessible from my applicaiton.

      Here is the code for same:
      try
      {
      Properties props = new Properties();
      File f = new File( absoluteFilePath);
      System.out.println(" f " + f.exists());
      props.load( new FileInputStream( absoluteFilePath ));
      System.setProperties( props );

      }catch(Exception e){}

      But I keep on getting this exception for line " System.setProperties(props) "

      java.lang.IllegalArgumentException: Null charset name
      at java.nio.charset.Charset.lookup(Charset.java:376)
      at java.nio.charset.Charset.isSupported(Charset.java:405)<Jan 30, 2004 6:37:21 PM PST>
      at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:67)<Jan 30, 2004
      at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:93)

      But if I do
      --------------

      Enumeration enum = props.propertyNames();
      while( enum.hasMoreElements() )
      {
      String key = (String) enum.nextElement();
      String value = props.getProperty( key );
      System.setProperty(key, value);
      }

      this works just fine. ( This makes my job done ! )
      But I'm just curios to know why System.setProperites( Property Object ) doesn't work.

      Can any body tell me what could be the reason ?

      thanks,
      rk

      but i