易截截图软件、单文件、免安装、纯绿色、仅160KB

几种读取属性文件的JAVA实现方式

 1.使用java.util.Properties类的load()方法
  
  示例:
Java代码
InputStream in = lnew BufferedInputStream(new FileInputStream(name));   
  Properties p = new Properties();   
  p.load(in);  
InputStream in = lnew BufferedInputStream(new FileInputStream(name));
  Properties p = new Properties();
  p.load(in);
  
  2.使用java.util.ResourceBundle类的getBundle()方法  
  示例:
Java代码
ResourceBundle rb = ResourceBundle.getBundle(name, Locale.getDefault());  
ResourceBundle rb = ResourceBundle.getBundle(name, Locale.getDefault());
  
  3.使用java.util.PropertyResourceBundle类的构造函数  
  示例:
Java代码
InputStream in = new BufferedInputStream(new FileInputStream(name));   
  ResourceBundle rb = new PropertyResourceBundle(in);  
InputStream in = new BufferedInputStream(new FileInputStream(name));
  ResourceBundle rb = new PropertyResourceBundle(in);
  
  4.使用class变量的getResourceAsStream()方法  
  示例:
Java代码
InputStream in = JProperties.class.getResourceAsStream(name);   
  Properties p = new Properties();   
  p.load(in);  
InputStream in = JProperties.class.getResourceAsStream(name);
  Properties p = new Properties();
  p.load(in);
  
  5.使用class.getClassLoader()所得到的java.lang.ClassLoader的getResourceAsStream()方法  
  示例:
Java代码
InputStream in = JProperties.class.getClassLoader().getResourceAsStream(name);   
  Properties p = new Properties();   
  p.load(in);  
InputStream in = JProperties.class.getClassLoader().getResourceAsStream(name);
  Properties p = new Properties();
  p.load(in);
  
  6.使用java.lang.ClassLoad


相关文档:

年底收藏系列 Java安全工具,生成MD5,Base64,UUID


/*
* EncryptUtils.java
* Copyright (C) 2007-3-19 <JustinLei@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ......

年底收藏系列 Java Web工具CookieSupport

/*
* CookieSupport.java
* Copyright (C) 2007-3-19 <JustinLei@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version ......

让用户不必安装JRE运行java程序

1、将项目打包好;
2、将JRE目压缩成JRE.rar,放在当前项目目录下;
2、下载GreenJVM,其中两个主要文件(GreenJVM.exe和vm.cfg)
3、用计事本打开vm.cfg设置参数,参数很多,只要设置下面几个就可以用了:
    SET_VM_NAME=jre.rar
    SET_START_JAR_PATH=***.jar   &nbs ......

Java邮件群发器

Java邮件群发器
 功能说明:
  1、批量循环发送邮件
  2、发送HTML文件,待发送的邮件以htm的格式存放,可以是网络上的htm文件,可以是本地的htm文件
  3、可以指定发送附件的目录,系统会加载指定目录的全部附件一起发送
  4、发送邮件以txt文件保存,每行保存一个邮件 ......

java常考的几个排序

1.写一个冒泡排序的程序。
        public class Sort
{
         public static void main(String[] args)
         {
           &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号