Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Set "file.encoding" System Property to default "UTF-8"

807580Nov 18 2009 — edited Feb 17 2010
When i execute my code some special character are not being display correct so by programming approach i am trying to set "file.encoding" system property to "UTF-8", using command System.setProperty( "file.encoding", "UTF-8" ); and it is not working.

If i run my jar using command java -Dfile.encoding=UTF-8 -jar myprog.jar . It is working and my special characters are also looking in right way.

Can i set this defalut encoding by programming approach.

Thanks

Ashish Pancholi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2010
Added on Nov 18 2009
8 comments
9,875 views