最近项目中需要调用msn和qq 所以就收集了一些相关自恋
调用qq的方法:
<A href="tencent://message/?uin=20989163&Site=博客园&Menu=yes"
target=blank点击这里给我发消息
</A>
对于qq 可以登录到http://imis.qq.com/webpresence/code.shtml 这里来这里设计和生成代码
调用msn的方法:
<A href="msnim:chat?contact=xxqq0824@hotmail.com" target=blank>点这里和我MSN聊天</A>
下面是一个简单的例子:
import java.io.*;
public class RunCommand {
public RunCommand() {
// 调用外部命令的时候一般不是单单开启那个程序,而是要用开启的程序做一些事
// 所以最好是像下面这样用数组来表示命令序列("命令","参数"[,"参数",...],"目标路径")
//String[] cmd = {"notepad.exe","C:settings.ini"};
//String[] cmd = {"cmd.exe","/c","start","excel"};
//String[] cmd = {"cmd.exe","/c","start","ping.exe","192.168.0.20"};
String[] cmd = {"cmd.exe","/c","start","ipconfig.exe","/all"};
try
{
// 下面一行是执行外部命令的关键
Process pro = Runtime.getRuntime().exec(cmd);
// 导致当前线程等待,如果必要,一直要等到由该 Process 对象表示的进程已经终止。
pro.waitFor();
} catch (IOException e)
{
//deal with IOException
e.printStackTrace();
} catch (InterruptedException e)
{
//deal with InterruptedException
e.printStackTrace();
}
}
public static void main (String[] args)
{
new RunCommand();
}
}