java解析properties的方法
1。使用java.util.Properties类的load()方法
示例: InputStream in = lnew BufferedInputStream(new FileInputStream(name));
Properties p = new Properties();
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 = new PropertyResourceBundle(in);
4。使用class变量的getResourceAsStream()方法
示例: InputStream in = JProperties.class.getResourceAsStream(name);
Properties p = new Properties();
p.load(in);
5。使用class.getClassLoader()所得到的java.lang.ClassLoader的getResourceAsStream()方法
示例: InputStream in = JProperties.class.getClassLoader().getResourceAsStream(name);
Properties p = new Properties();
p.load(in);
、6。使用java.lang.ClassLoader类的getSystemResourceAsStream()静态方法
示例: InputStream in = ClassLoader.getSystemResourceAsStream(name);
Properties p = new Properties();
p.load(in);
补充
Servlet中可以使用javax.servlet.ServletContext的getResourceAsStream()方法
示例:InputStream in = context.getResourceAsStream(path);
Properties p = new Properties();
p.load(in);
相关文档:
代码如下:
1 String command = " cmd /c C:/Program Files/MySQL/MySQL Server 5.0/bin>mysqldump -h localhost -u root -p aijia > E:/aijia.dmp " ;
2 try {
3 Process process& ......
程序没什么含金量,高手莫笑。
package first;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import ......
将Java应用程序本地编译为EXE的几种方法(推荐使用JOVE和JET)
1. 从www.towerj.com获得一个TowerJ编译器,该编译器可以将你的CLASS文件
编译成EXE文件。
2. 利用微软的SDK-Java 4.0所提供的jexegen.exe创建EXE文件,这个软件可以
从微软的网站免费下载,地址如下:
ht ......
在javaeye上搜到一篇robbin关于java序列化的回复,我觉得其中的例子很有说服力,转过来和大家分享。
关于更多java序列化的问题可以参见JAVA系列之对象的序列化与反序列化
Java的序列化机制只序列化对象的属性值,而不会去序列化什么所谓的方法。其 ......
由于工作需要,要用.net的程序调用一个java编写的web service接口,接口的一个参数要求md5方式加密。
.net中的md5加密是很容易的,采用msdn中给出的方法:
// Hash an input string and return the hash as
// a 32 character hexadecimal string.
static string getMd5Hash(string input)
{
......