Click here to Skip to main content
12,073,837 members (65,850 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Java
Hello,
I want to open a CHM (help) file from my java application...
My code looks like that:
Runtime.getRuntime().exec("hh.exe myhelpfile.chm");
It works, but how can i open it with a specific page??

Thanks,
Tom Smile | :)
Posted 17-Aug-10 20:53pm
Edited 4-Mar-11 14:29pm
Dalek Dave433.2K
v2
Comments
Dalek Dave 4-Mar-11 19:29pm
   
Edited for code block and readability.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

I was actually able to get this to work successfully based on tvizel88's comment; the critical problem is that the HTML is not usually cached in the CHM file in /the/full/path/form.
If you do as he suggests, but using the topic ID specified in the help creation software, that should work better (at least it did for me).
If you are having trouble, do as Richard MacCutchan suggests and try it from the command line, to take Java out of the equation.
This worked fine for me:
hh.exe UserManual.chm::/Using_This_Help_System.htm
I am using Help & Manual 5 to produce the CHM file, and Using_This_Help_System shows up as the topic ID, even though it is actually embedded a couple layers down in my table of contents. I was initially trying to include the full path implied by the TOC, and that didn't work at all.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You'd need to read the docs to find out if you can specify a page from the command line. Java plainly has no idea what it is doing, it's just passing on a run command.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I have found something like that:
Runtime.getRuntime().exec("hh.exe myhelpfile.chm::/path/to/my/page.htm");

but it doesn't work for me.
Is there no solution for that problem in java?
  Permalink  
v2
Comments
Richard MacCutchan 18-Aug-10 5:09am
   
This is not a Java problem. You need to make sure that your command "hh.exe ..." is correctly formatted and includes the required options. Try typing it in a command window to make sure it works.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

It is simple solution

String fileName = "C:\\Users\\Riyasam\\Documents\\NetBeansProjects\\Student Project\\src\\studentproject\\resources\\RealWorld.chm";
String[] commands = {"cmd", "/c", fileName};
try {
Runtime.getRuntime().exec(commands);
//Runtime.getRuntime().exec("C:\\Users\\Riyasam\\Documents\\NetBeansProjects\\SwingTest\\src\\Test\\RealWorld.chm");
} catch (Exception ex) {
ex.printStackTrace();
}

enjoying from now.. :P
  Permalink  
Comments
raj100mac 8-Apr-13 2:03am
   
Sir i made a rpoject using java and eclipse.and i also made a .chm help file.sir i want to attach this .chm file to my java project.plz give me the complete format of code.including details of coding.plz help me.
raj100mac 8-Apr-13 2:04am
   
from the above code which type of file i have to made.like class,jsp,wwhat and how to use them.help me immediatly,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 12 May 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100