自己使用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#写一个这样的小程序
相关文档:
一、JSON 是什么?
JSON 的全称是JavaScript Object Notation,是一种轻量级的数据交换格式。
JSON 与XML 具有相同的特性,例如易于人编写和阅读,易于机器生成和解析。但是JSON 比
XML 数据传输的有效性要高出很多。JSON 完全独立与编程语言,使用文本格式保存。
JSON 数据有两种结构:
• Name-Value 对构成的集 ......
记得第一次接触闭包的时候,觉得很奇怪,但从字面上很那理解闭包什么玩意,和闭包有的一比的当属控制反转,真正理解了后觉得就平常了。闭包二字其实是很经典的,闭包代码所表现的东西可不就是一个封闭的、自成一体的功能块吗?简单的说,闭包就是在内部定义的方法,拿到外面去使用。经典的javascript闭包形式如下:
Java代 ......
需要dom4j.jar文件 ,自行下载。 test.xml 1: <?xml version="1.0" encoding="gbk"?>
2:
3: <students>
4: <person sex="男" age="21">
5: <id>1</id>
6: <name>章治鹏</name>
7: <homepage&g ......
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 ......