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

JAVA读取Properties文件的六种方法

 
使用J2SEAPI读取Properties文件的六种方法
  1。使用java.util.Properties类的load()方法示例:InputStream in=lnew BufferedInputStream(new FileInputStream(name));
properties p=newProperties(); p.load(in);
  2。使用java.util.ResourceBundle类的getBundle()方法示例:ResourceBundle rb=ResourceBundle.getBundle
(name,Locale.getDefault());
  3。使用java.util.PropertyResourceBundle类的构造函数示例:InputStream in=new BufferedInputStream(new FileInputStream
(name));ResourceBundle rb=newPropertyResourceBundle(in);
  4。使用class变量的getResourceAsStream()方法示例:InputStream in=JProperties.class.getResourceAsStream(name);
properties p=newProperties(); p.load(in);
  5。使用class.getClassLoader()所得到的java.lang.ClassLoader的getResourceAsStream()方法示例:InputStream
in=JProperties.class.getClassLoader().getResourceAsStream(name); properties p=newProperties(); p.load(in);
  6。使用java.lang.ClassLoader类的getSystemResourceAsStream()静态方法示例:InputStream
in=ClassLoader.getSystemResourceAsStream(name); properties p=newProperties(); p.load(in);
  补充
  Servlet中可以使用javax.servlet.ServletContext的getResourceAsStream()方法示例:InputStream
in=context.getResourceAsStream(path); properties p=newProperties(); p.load(in);


相关文档:

java 调用dll文件

//1.创建testdll.java文件
public class testdll
{
static
{
System.loadLibrary("goodluck");
}
public native static int get();
public native static void set(int i);
public static void main(String[] args)
{
testdll test = new testdll();
test.set(10);
System.out.println(test.get() ......

【广告】阿里巴巴ITBU急聘资深Java开发工程师

职位描述:
1、按USECASE进行业务需求分析和软件概要设计;
2、进行软件详细设计和编码实现,确保性能、质量和安全;
3、维护和升级现有软件产品,快速定位并修复现有软件缺陷。
职位要求:
1、精通Web编程,3年以上使用Java语言进行web开发的经验,熟悉html,javascript。
2、精通jsp,servlet,java bean,JM ......

浅析Java序列化机制

    Java当中的序列化,其主要的作用是将类的实例进行无损传输,或者说就是通过Java的序列化机制,Java类的实例可以通过Object流来传输和重新获取,而不会损坏类的实例。
    首先,我们看看什么样的类是序列化类,
      1.A类自身实现了Serializable接口的类; ......

Java打包成可执行文件步骤详解

核心思想:把含main方法的入口类添加到MANIFEST.MF文件中。
步骤:
假设有两个类文件要打包,它们分别属于不同的package。
package com.test.jar;   
import java.awt.*;   
import javax.swing.*;   
public class Jar extends JFrame   
{  ......

在Java中实现浮点数的精确计算

标题     在Java中实现浮点数的精确计算    AYellow(原作) 修改   
关键字     Java 浮点数 精确计算  
问题的提出:
如果我们编译运行下面这个程序会看到什么?
public class Test{
    public static void mai ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号