private static void setConfig(){
try {
// String path = System.getProperty("user.dir") + "\\dbpool.properties";
String path = "./lib/setting.txt";
// FileInputStream is = new FileInputStream(path);
Properties props = new Properties();
// props.load(is);
props.setProperty("dslname",textField.getText().trim());
props.setProperty("dslacc",textField_1.getText().trim());
props.setProperty("dslpsw",textField_2.getText().trim());
//props.store (is);
PrintStream fW = new PrintStream(new File(path));
props.list(fW );
// timeout = Integer.parseInt(props.getProperty("timeout"));
// waitforresult=Integer.parseInt(props.getProperty("waitforresult"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.err.println("�����ļ��Ҳ���");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.err.println("��ȡ�����ļ�����");
}
}
private static void readConfig(){
try {
// String path = System.getProperty("user.dir") + "\\dbpool.properties";
String path = "./lib/setting.txt";
FileInputStream is = new FileInputStream(new File(path));
// FileInputStream.
Properties props = new Properties();
InputStreamReader reader = new InputStreamReader(is,"UTF-8");
props.load(reader);
//props.load(is);
dslname=props.getProperty("dslname");
dslacc=props.getProperty("dslacc");
dslpsw=props.getProperty("dslpsw");
textField.setText(new String(dslname.getBytes("utf-8"),"utf-8"));
textField_1.setText(dslacc);
textField_2.setText(dslpsw);
// timeout = Integer.parseInt(props.getProperty("timeout"));
// waitforresult=Integer.parseInt(props.getProperty("waitforresult"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.err.println("�����ļ��Ҳ���");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.err.println("��ȡ�����ļ�����");
}
}

  

Properties 使用,注意编码的更多相关文章

  1. properties中的编码如何生成:例如\u7AD9\u70B9这种。

    在eclipse中的properties中的一种编码,例如\u7AD9\u70B9,是如何自动生成的. 这种编码方式当你要增加某个字段的时候,也要相应的添加这种编码方式下的格式,具体方法如下:

  2. properties中的编码如何生成:例如\u7AD9\u70B9这种

    在eclipse中的properties中的一种编码,例如\u7AD9\u70B9,是如何自动生成的. 这种编码方式当你要增加某个字段的时候,也要相应的添加这种编码方式下的格式,具体方法如下:

  3. properties的编码问题

    1.在eclipse中,如果不专门设置,properties文件的编码是ISO-8859-1,最好将其改为UTF-8 2.当properties文件的编码改为UTF-8还不够,Spring的conte ...

  4. Java读写资源文件类Properties

    Java中读写资源文件最重要的类是Properties 1) 资源文件要求如下: 1.properties文件是一个文本文件 2.properties文件的语法有两种,一种是注释,一种属性配置.  注 ...

  5. unicode编码和中国的相互转换

    如果你的原始文件1.properties(该文件的编码中国).要转换unicode的 在cmd通过进入你在哪里在这种类型的文件夹: native2ascii -encoding gb2312 1.pr ...

  6. JAVA提高十三:Hashtable&Properties深入分析

    最近因为一些琐碎的事情,导致一直没时间写博客,正好今天需求开发完的早,所以趁早写下本文,本文主要学习的是Hashtable的分析,因为上面一篇文章研究的是HashMap,而Hashtable和Hash ...

  7. excel中的数据导出为properties和map的方法

    在做项目的过程中,经常需要处理excel数据,特别是和业务人员配合时,业务人员喜欢使用excel处理一些数据,然后交给我们技术人员进行程序处理.利用POI读取写入excel数据,是经常使用的一个情景. ...

  8. jdbc.properties+web.xml

    1. jdbc.properties #\u8FDE\u63A5\u8BBE\u7F6E[左边是properties被IDE编码后的结果] jdbc.driverClassName=com.mysql ...

  9. 解决Eclipse中.properties文件中文乱码问题

    在.properties文件写注释时,发现中文乱码了,由于之前在idea中有见设置.properties文件的编码类型,便找了找乱码原因 在中文操作系统中,Eclipse中的Java类型文件的编码的默 ...

  10. java读取properties中文乱码

    1 确认properties文件的编码是utf-8 2 采用流的方式读取文件,设置编码为utf-8 public class ErrorCodeConfig { static Properties p ...

随机推荐

  1. LeetCode OJ 113. Path Sum II

    Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...

  2. Hunters

    Hunters Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submi ...

  3. 使用 Flex 库项目---打包swc

    来源:http://help.adobe.com/zh_CN/flashbuilder/using/WSe4e4b720da9dedb5-1a92eab212e75b9d8b2-7ffe.html   ...

  4. 指定的命名连接在配置中找不到、非计划用于 EntityClient 提供程序或者无效

    以下内容来自互联网 (1)web: 需要在客户端配置文件的中增加connectionString节点,此节点描述了EntityClient的连接信息. 例如: 在web.config的中增加conne ...

  5. freemarker中的list 前端模板

    freemarker list (长度,遍历,下标,嵌套,排序)1. freemarker获取list的size : JavaArrayList<String> list = new Ar ...

  6. 校验 MD5 值

    Linux 环境下:打开终端,输入命令:"md5sum filename",将结果与网页提供值对比.Windows 环境下:下载 MD5 校验软件并使用.

  7. SQL Server 2008删除或压缩数据库日志的方法

    SQL Server 2008删除或压缩数据库日志的方法 2010-09-20 20:15 由 于数据库日志增长被设置为“无限制”,所以时间一长日志文件必然会很大,一个400G的数据库居然有600G的 ...

  8. Windows下的 Axel下载工具 - 移植自Linux

    Axel 是 CLI (command-line interface) 下的一个多线程下载工具,通常我都用它取代 wget 下载各类文件,适用于 Linux 及 BSD 等 UNIX 类平台. 以下是 ...

  9. sql查询百分号的方法

    select * from [tablename] where [col] like '%100/%%' escape '/'

  10. 转载,find.sh

    #!/bin/bash #find files contains a keyword #write by xiaojing.zhao #2012.12.14 echo -e "\nThis ...