易截截图软件、单文件、免安装、纯绿色、仅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入门

 Java学习从入门到精通 
一、 JDK (Java Development Kit) 
JDK是整个Java的核心,包括了Java运行环境(Java Runtime Envirnment),一堆Java工具和Java基础的类库(rt.jar)。不论什么Java应用服务器实质都是内置了某个版本的JDK。因此掌握JDK是学好Java的第一步。最主流的J ......

sql 2005 存储过程分页 java 代码

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列 ......

JAVA目录选择框的解决办法

FileDialog只能选择文件而不能选择文件夹。JFileChooser又太大,不太好看,鼓捣了好一会终于解决了。
记录一下关键部分代码,以备查用。
final JButton choose=new JButton("选择存储文件目录");
final JTextField dir=new JTextField();

final JFileChooser chooser=new JFileChooser();
chooser.setFileSe ......

年底收藏系列 Java Web工具SessionTick

package org.lambdasoft.web.support;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import org.lambdasoft.web.Enviroment;
public class SessionSupport {
private SessionS ......

让用户不必安装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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号