如何在Netbeans中使用UTF-8字符 [英] How to use UTF-8 character in Netbeans

查看:189
本文介绍了如何在Netbeans中使用UTF-8字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Netbeans6.9.1 IDE,并希望使用Java在输出控制台中显示汉字. 我从网页复制了中文字符,然后在"之间复制了中文字符.但不支持.

I am using Netbeans6.9.1 IDE and wants to show the Chinese characters in the output console using java. I copied the Chinese charater from a web page and copied between the "". but its not supported.


         String char1="世界你好";
         System.out.println(char1);

我需要在IDE中进行某些设置还是在Java代码中使用某些设置?

Do I need to do some setting in IDE or use some settings in my Java code?

推荐答案

从NetBeans安装目录中的etc目录中编辑文件netbeans.conf. 在netbeans_default_options选项中,添加-J-Dfile.encoding=UTF-8.

Edit the file netbeans.conf from the etc directory located at the installation directory of NetBeans. In the netbeans_default_options option, add -J-Dfile.encoding=UTF-8.

适用于NetBeans中的控制台输入和输出.

Works for both console input and output in NetBeans.

这篇关于如何在Netbeans中使用UTF-8字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆