首页 > 编程语言 > 详细

使用java代码打开chm格式的帮助文档

时间:2016-04-06 11:23:18      阅读:431      评论:0      收藏:0      [点我收藏+]

package com.guan.code20160405;

import java.io.File;
import java.io.IOException;

public class OpenHelpFile {

public static void main(String[] args) {

/**

*我把五子棋文档1.0.chm放在和项目同目录下的projectFile文件夹下

*/
String ch1="/";
String ch2="//";
//找到项目的根路径
String contextPath = System.getProperty("user.dir");
File file=new File(contextPath);
String p = file.getParent();
file = new File(p + "/projectFile");
System.out.println("path===="+file.getPath());
System.out.println("parent==="+file.getParent());
String helpFilePath = p + "/projectFile/五子棋文档1.0.chm";
try {

//hh.exe是Windows系统中允许chm文件的程序
Runtime.getRuntime().exec("hh.exe "+helpFilePath.replaceAll(ch1,ch2));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}

运行,成功打开“五子棋文档1.0.chm”文件。

使用java代码打开chm格式的帮助文档

原文:http://www.cnblogs.com/gwq369/p/5358091.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!