This discussion is archived
1 Reply Latest reply: Feb 3, 2004 11:45 AM by 807582 RSS

java.lang.IllegalArgumentException: Null charset name

807582 Newbie
Currently Being Moderated

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:
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(
at java.nio.charset.Charset.isSupported(<Jan 30, 2004 6:37:21 PM PST>
at sun.nio.cs.StreamEncoder.forOutputStreamWriter(<Jan 30, 2004

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 ?


but i