自己使用java做的小工具
当你在你自己的电脑上装的东西比较多的时候,而且执行程序有很乱,让你也很不好找,下面这个是我用java写的一段小程序,直接在你的运行窗口输入 java open ??就可以打开你自己的想要的环境或者工具了
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class open {
public static void main(String [] s){
Map m=new HashMap();//使用map集合
m.put("cb","C:/Program Files/Kingsoft/PowerWord_Oxford/XDict.exe");//通过键值来保存你可执行程序的物理路径
m.put("360","C:/Program Files/360/360safe/360Safe.exe");
m.put("flash","C:/Program Files/Macromedia/Flash 8/Flash.exe");
m.put("d8","C:/Program Files/Macromedia/Dreamweaver 8/Dreamweaver.exe");
m.put("flash","C:/Program Files/ipmsg/ipmsg.exe");
m.put("netBeans","C:/Program Files/NetBeans 6.5.1/bin/netbeans.exe");
m.put("php","C:/Program Files/Zend/Zend Studio for Eclipse - 6.1.2/ZendStudio.exe");
String ss=s[0];//程序启动时给程序参数赋值
try {
Runtime.getRuntime().exec((String)m.get(ss));//调用程序
} catch (IOException e) {
System.out.println("程序运行错误");
}
}
}
不过这个用java写还是比较不好用的,一会我看看在用C#写一个这样的小程序
相关文档:
1. 代理模式主要有两种:静态代理和动态代理
2. 静态代理:
比如要在输出“HelloWorld”前打印一个字符串“Welcome”
A:先定义一个接口类
Java代码
package ttitfly.proxy;
public interface HelloWo ......
使用类java.io.File
1.获取系统硬盘信息:
public static String getDiskInfo() {
StringBuffer sb=new StringBuffer();
File[] roots = File.listRoots();// 获取磁盘分区列表
for (File file : roots) {
long totalSpace=file.getTotalSpace();
long freeSpace=file.getFreeSpace();
long usa ......
JAVA容器
解释一:
容器(Container)
Spring 提供容器功能,容器可以管理对象的生命周期、对象与对象之间的依赖关系,您可以使用一个配置文件(通常是XML),在上面定义好对象的名称、如何产生(Prototype 方式或Singleton 方式)、哪个对象产生之后必须设定成为某个对象的属性等,在启动容器之后,所有 ......
Object Ordering
A List l may be sorted as follows.
Collections.sort(l);
If the List consists of String elements, it will be sorted into alphabetical order. If it consists of Date elements, it will be sorted into chronological order. How does this happen? String and Date both implement the Compara ......